Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#3,394 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@ShivamSharma43 đang làm issue này rồi.

Từ ngày 20/10/2026.

  • #3396 của @ShivamSharma43 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
security, testing-qa

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
4.6k
Fork
962
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
398

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/PyRIT

Tất cả issue của microsoft/PyRIT

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.