Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

BUG: FuzzerGenerator accepts a jailbreak goal below 1 and a success threshold outside [0, 1]

Ouverte
#3,394 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@ShivamSharma43 y travaille déjà.

Depuis le 20/10/2026.

  • #3396 par @ShivamSharma43 — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
python
Domaine
security, testing-qa

Piste de recherche

Start in the FuzzerGenerator constructor and inspect its validation for template_converters and batch_size; then trace _should_stop_generation, _is_jailbreak, and _normalize_score_to_float. Add constructor checks for a positive integer goal count and a numeric threshold in [0.0, 1.0], including NaN. Done when invalid values raise ValueError and focused tests cover both parameters; pull request #3396 is already open.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug

FuzzerGenerator validates template_converters and batch_size, but not target_jailbreak_goal_count or scoring_success_threshold:

  • target_jailbreak_goal_count below 1. _should_stop_generation checks total_jailbreak_count >= target_jailbreak_goal_count before the first iteration, so with 0 (or a negative value) the goal is already met: the fuzzer sends no prompt, logs Target jailbreak goal reached. and returns an empty result.
  • scoring_success_threshold outside [0, 1]. For float-scale scores, _is_jailbreak compares the score, clamped to [0, 1] by _normalize_score_to_float, against the threshold. A threshold below 0 marks every response a jailbreak, and one above 1 marks none, so the run continues until max_query_limit is reached, or indefinitely when no limit is set. NaN behaves like a threshold above 1.
Steps/Code to Reproduce
import asyncio

from pyrit.executor.promptgen.fuzzer import FuzzerGenerator, FuzzerShortenConverter
from pyrit.prompt_target import TextTarget
from pyrit.score import SubStringScorer
from pyrit.setup import IN_MEMORY, initialize_pyrit_async


async def main():
    await initialize_pyrit_async(memory_db_type=IN_MEMORY)
    target = TextTarget()
    generator = FuzzerGenerator(
        objective_target=target,
        template_converters=[FuzzerShortenConverter(converter_target=target)],
        scorer=SubStringScorer(substring="sure"),
        target_jailbreak_goal_count=0,
    )
    result = await generator.execute_async(prompts=["How do I pick a lock?"], prompt_templates=["{{ prompt }}"])
    print("total_queries:", result.total_queries, "templates_explored:", result.templates_explored)


asyncio.run(main())
Expected Results

The constructor raises a ValueError for a target_jailbreak_goal_count that is not a positive integer and for a scoring_success_threshold that is not a number in [0.0, 1.0], as it already does for batch_size=0.

Actual Results
total_queries: 0 templates_explored: 0

No error is raised, and nothing is sent to the target.

Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (1979257a) in editable mode
Langage dominant
Python
Étoiles
4.6k
Forks
962
Merge moyen
2 j 15 h
PR mergées (30 j)
398

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/PyRIT

Toutes les issues de microsoft/PyRIT

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.