BUG: ManyShotJailbreakAttack accepts a negative example_count and drops examples from the end
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- security, testing-qa
調査の方向性
Start at ManyShotJailbreakAttack.validate_constructor_parameters and the construction path described in the issue; check how the REST TechniqueService.create_async path uses that validation. Add coverage for non-positive, boolean, and non-integer example_count values at construction and validation, then confirm invalid values raise a ValueError naming example_count. An open linked pull request (#3395) indicates work is already underway.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
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.
Steps/Code to Reproduce
import asyncio
from unittest.mock import MagicMock
from pyrit.executor.attack import ManyShotJailbreakAttack
from pyrit.prompt_target import PromptTarget
from pyrit.setup import IN_MEMORY, initialize_pyrit_async
asyncio.run(initialize_pyrit_async(memory_db_type=IN_MEMORY))
target = MagicMock(spec=PromptTarget)
examples = [{"user": f"q{i}", "assistant": f"a{i}"} for i in range(5)]
for count in (-1, -4, True):
attack = ManyShotJailbreakAttack(objective_target=target, example_count=count, many_shot_examples=examples)
print(count, len(attack._examples))
print(len(ManyShotJailbreakAttack(objective_target=target, example_count=-1)._examples))
Expected Results
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 (1979257a) in editable mode
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 962
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 398
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>対応中かも @aatif101 が 1 日前に担当しました。 オープンBug: triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/PyRIT#3343 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG: UrlConverter preserves forward slashes by default, preventing path payload evasion対応中かも @Kaap10 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
-
BUG: XSSOutputScorer misses SVG and JavaScript data URIs対応中かも @Kaap10 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
-
BUG: FuzzerGenerator accepts a jailbreak goal below 1 and a success threshold outside [0, 1]対応中かも @ShivamSharma43 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
-
[BLOCKED] FEAT: Drill into paired Scenario outcome conversations対応中かも @shashank03-dev が 1 日前に担当しました。 オープンfeature-request help wanted
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
microsoft/PyRIT#3389 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
521xueweihan/HelloGitHub#4063 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Vanilla-OS/apx-gui#112 ·
-
Devstral and Voxtral: section 5 fails in us-east-1 with 400 "Model does not support audio modality"オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws-samples/sample-per-model-bedrock#409 ·
メンテナーはふだん 1 日以内に返信
-
DuckDB 2.0 breaks to_pyarrow_batches対応中かも @DG47 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ibis-project/ibis#12196 ·
メンテナーはふだん 1 日以内に返信