Skip to content

FIX: Include the inline template value in the TextJailbreakConverter identifier - #4085

Merged
Roman Lutz (romanlutz) merged 7 commits into
microsoft:mainfrom
HhH666-ux:fix-text-jailbreak-template-identifier
Nov 17, 2026
Merged

Roman Lutz (romanlutz) merged 7 commits into
microsoft:mainfrom
HhH666-ux:fix-text-jailbreak-template-identifier

Conversation

@HhH666-ux

Copy link
Copy Markdown
Contributor

Description

TextJailbreakConverter._build_identifier only recorded template_source, which is the constant <string_template> for every inline TextJailBreak. Two converters built from different inline jailbreaks therefore shared one hash and one default registry name.

  • Add a hash of the resolved template value to the identifier parameters while keeping the existing template source.
  • Add a regression test with two different inline templates.

Fixes #3760

Copilot AI balanced review requested due to automatic review settings November 9, 2026 04:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The resolved jailbreak_template case remains in KNOWN_GAPS, causing the strict xfail contract test to fail with XPASS(strict) until the obsolete entry is removed.

1 open issue
What changed in this PR

Addresses #3760 by making TextJailbreakConverter identifiers distinguish different inline templates, preventing shared hashes and default registry names.

Changes:

  • Add a content hash of the resolved template while preserving its source.
  • Add a regression test asserting that different inline templates produce different identifiers.
File Description
tests/​unit/​converter/​test_text_jailbreak_converter.py Tests identifier uniqueness for two inline templates.
pyrit/​converter/​text_jailbreak_converter.py Includes a truncated SHA-256 template hash in identifier parameters.

Review effort: Balanced

@romanlutz

Copy link
Copy Markdown
Contributor

The underlying issue is assigned to someone else so I'm closing this as duplicate unless the issue owner releases it or doesn't respond.

The inline-template gap is fixed by the template value hash, so the
strict xfail in the identifier contract test would now fail as XPASS.
Also check the identifier hash first in the regression test and update
the _build_identifier docstring to mention the template value hash.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HhH666-ux

Copy link
Copy Markdown
Contributor Author

Checking in now that 11/11 has passed — did the owner of #3760 release the issue? The KNOWN_GAPS entry for this converter is already removed (369383c) and the branch is otherwise ready, so I can rebase whenever you want to reopen and review.

@romanlutz

Copy link
Copy Markdown
Contributor

Checking in now that 11/11 has passed — did the owner of #3760 release the issue? The KNOWN_GAPS entry for this converter is already removed (369383c) and the branch is otherwise ready, so I can rebase whenever you want to reopen and review.

There was no response so I freed it up for you.

Resolve the KNOWN_GAPS conflict: main removed the PolicyPuppetryConverter
entry (microsoft#4084) and this branch removed the TextJailbreakConverter entry,
so only the CodeChameleonConverter entries remain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HhH666-ux

Copy link
Copy Markdown
Contributor Author

Hi Roman Lutz (@romanlutz) — thanks for freeing #3760 and for the approval.

One heads-up in case your settings require an approval on the latest head: since that approval I had to merge main once more (188d4e3c).

  • The only conflict was KNOWN_GAPS in converter_identifier_samples.py: main removed the PolicyPuppetryConverter entry (FIX: Include the custom template value in the PolicyPuppetryConverter identifier #4084) while this branch removes the TextJailbreakConverter entry. Both removals are kept, and the two CodeChameleonConverter entries are untouched.
  • Nothing functional changed beyond that: _build_identifier() still adds jailbreak_template_hash (sha256 of the resolved template value, first 16 hex chars) next to jailbreak_template_path, and test_identifier_distinguishes_inline_templates asserts two different inline templates no longer collapse onto one identifier.

CI is green on 188d4e3c — Build and test, CodeQL, and the frontend E2E shards all pass.

Is there anything else you need before this can land? If it is waiting on a code owner, a pointer to who that is would help. Happy to reshape the change too — e.g. split the hash into its own PR, or drop it in favour of whatever the identifier convention settles on — if that makes it easier to take.

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 17, 2026
Merged via the queue into microsoft:main with commit 1b7c50a Nov 17, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: TextJailbreakConverter gives every inline template the same identifier

3 participants