Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#3,394 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@ShivamSharma43 ci sta già lavorando.

Dal 20/10/2026.

  • #3396 di @ShivamSharma43 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
4.6k
Fork
962
Merge medio
2g 15h
PR unite (30g)
398

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/PyRIT

Tutte le issue di microsoft/PyRIT

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.