FEAT: Add supports_prefill capability and PrefillAttack strategy
维护者通常 2 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
调研方向
Start with TargetCapabilities and CapabilityName to see how existing flags are declared, then read SkeletonKeyAttack in pyrit/executor/attack/single_turn/ to see how a trailing assistant message is already used to prime a target. The open questions (one PR or two, which targets set the flag) need a maintainer decision before the work starts. Done means the flag exists and round-trips through serialization, and PrefillAttack raises on targets without PREFILL in TARGET_REQUIREMENTS.
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
Some targets let the caller write the first part of the model's reply: the request ends with an open assistant turn, and the model continues it. Prefill attacks rely on this, and recent work shows they're effective against current open-weight models (arXiv:2602.14689 tested more than 20 strategies). PyRIT can't test for this properly:
TargetCapabilitiesdoesn't record whether a target continues a trailing assistant message. Completion endpoints and local Hugging Face models do. Most hosted chat APIs ignore it or reject the request. Without a flag, an attack that depends on prefill can't require it.- You can end a
prepended_conversationon an assistant message, the same waySkeletonKeyAttackprimes a target, but no attack is built around it. On a target that drops the assistant turn, the model just answers the user message, and the result looks like the model resisted the attack.
Describe the solution you'd like
- Capability. Add
CapabilityName.PREFILL = "supports_prefill"andsupports_prefill: bool = FalseonTargetCapabilities. Set it for targets that continue a trailing assistant turn (completion-style and locally hosted ones) and leave it false for hosted chat APIs. - Attack. Add
PrefillAttack(PromptSendingAttack)inpyrit/executor/attack/single_turn/, next toSkeletonKeyAttack. It takes the objective and aprefill_text, ends the conversation with an assistant message carrying that text, sends it, and scores the continuation.TARGET_REQUIREMENTSrequiresPREFILL, so an unsupported target raises an error up front.
Unit tests would cover the prefill being the final assistant piece, the error on an unsupported target, scoring, and the new field round-tripping through serialization. The PR would also add a doc entry.
Describe alternatives you've considered, if relevant
- Only the capability flag. Users would build the
prepended_conversationby hand each time, and nothing would check the target. - A converter. Converters change prompt text and can't add an assistant turn.
Additional context
Hosted APIs are dropping support for caller-set assistant turns, so this mostly matters for open-weight and completion-style targets. PyRIT tests those too.
- Struppek, Gleave, Pelrine (FAR.AI), arXiv:2602.14689: https://arxiv.org/abs/2602.14689
- Dotsinski, Eustratiadis, "Sockpuppetting", arXiv:2601.13359: https://arxiv.org/abs/2601.13359
Questions:
- Do you want a
supports_prefillcapability? - One PR, or the capability first and the attack second?
- Which targets should have the flag set, beyond the obvious ones?
- 主要语言
- Python
- 星标
- 4.6k
- 派生
- 944
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 369
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/PyRIT 的其他 Issue
-
BUG: label queries only return the final conversation of an attack可能已有人在做 @u7k4rs6 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
microsoft/PyRIT#3095 · 4 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
BUG Configuration keeps runtime-status errors after polling recovers可能重新可做 @joeyvictorino 于 7 天前认领,目前没有进行中的 PR。 未关闭Bug: triage GUI help wanted
难度 2/5 1-3 小时 新手友好度 86/100
microsoft/PyRIT#2868 · 6 条评论 ·
维护者通常 2 天内回复
-
FEAT: Support PDF and file inputs via `binary_path` in OpenAI chat and response targets可能已有人在做 @PranavD2905 今天认领。 未关闭feature-request help wanted
难度 4/5 3-5 天 新手友好度 35/100
microsoft/PyRIT#3274 · 1 条评论 ·
维护者通常 2 天内回复
-
feature-request
难度 5/5 一周以上 新手友好度 18/100
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 34/100
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
lidofinance/diffyscan#239 ·
维护者通常 1 天内回复
-
area: tools documentation good first issue ready for a contributor
难度 2/5 1-3 小时 新手友好度 82/100
eyalgolan/statecraft-israel#873 · 1 条评论 ·
维护者通常 1 天内回复
-
GET rooms API returns 500 due to nonexistent Room.is_active attribute可能已有人在做 @Mars-60 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 5 天内回复
-
Harmony OPeNDAP SubSetter (HOSS) Geographic production rssmif16d 7 XYZ_PROV
难度 2/5 1-3 小时 新手友好度 62/100
nasa/harmony-autotester#341 ·