You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: ManyShotJailbreakAttack accepts a negative example_count and drops examples from the end #3393
ManyShotJailbreakAttack uses example_count as a slice bound (examples[:example_count]), but validate_constructor_parameters only rejects 0. A negative count is accepted and silently drops examples from the end of the list instead of selecting from the start, so example_count=-1 with the bundled dataset sends 399 examples, and with five custom examples -1 keeps four and -4 keeps one. True is accepted as 1, and non-integers fail with an unrelated error (2.5 raises TypeError: slice indices must be integers..., -5 with five examples raises the misleading Many shot examples must be provided.).
Because the check sits in validate_constructor_parameters, the REST technique API (TechniqueService.create_async) also accepts {"example_count": -1} and stores a technique that later runs with the wrong number of examples. The neighbouring bounds in that API (max_attempts_on_failure, max_turns, tree_depth, chunk_size, ...) are all rejected up front.
example_count values that are not positive integers raise a ValueError naming example_count, both at construction and in validate_constructor_parameters.
Actual Results
-1 4
-4 1
True 1
399
Screenshots
N/A
Versions
OS: Windows 11
Python version: 3.11.9
PyRIT version: installed from main (1979257) in editable mode
Activity