Skip to content

FIX: Include the prompt template and target in the Fuzzer converter identifier - #4087

Open
电大老baby (HhH666-ux) wants to merge 1 commit into
microsoft:mainfrom
HhH666-ux:fix-fuzzer-converter-identifier
Open

电大老baby (HhH666-ux) wants to merge 1 commit into
microsoft:mainfrom
HhH666-ux:fix-fuzzer-converter-identifier

Conversation

@HhH666-ux

Copy link
Copy Markdown

Description

FuzzerConverter and its subclasses defined no _build_identifier, so prompt_template and converter_target never reached the identifier. Each request still recorded the converter per piece, so converters configured with different templates or targets shared one hash.

  • Add _build_identifier to the base class with a hash of the system prompt template and the converter target identifier.
  • Add a regression test over all fuzzer subclasses using two different templates.

Fixes #3840

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

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 regression test does not cover distinct target identifiers, so removing the target argument could leave it passing while allowing target collisions to recur.

1 open issue
What changed in this PR

This PR addresses #3840 by making fuzzer converter identifiers distinguish configurations with different prompt templates or targets.

Changes:

  • Add a shared identifier builder containing the prompt template hash and converter target identifier.
  • Add template-distinction regression coverage for all five fuzzer converter subclasses.
File Description
tests/​unit/​executor/​promptgen/​fuzzer/​test_fuzzer_converter.py Tests that different templates produce different converter hashes.
pyrit/​executor/​promptgen/​fuzzer/​fuzzer_converter_base.py Includes template and target information in converter identifiers.

Review effort: Balanced

params={
"system_prompt_template_hash": hashlib.sha256(self.system_prompt.encode("utf-8")).hexdigest()[:16],
},
converter_target=self.converter_target.get_identifier(),

This branch has not been deployed

No deployments
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: Fuzzer converters share one identifier across prompt templates and targets

2 participants