Repository navigation
FIX: Include the prompt template and target in the Fuzzer converter identifier - #4087
Open
电大老baby (HhH666-ux) wants to merge 1 commit into
Open
电大老baby (HhH666-ux) wants to merge 1 commit into
电大老baby (HhH666-ux) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
FuzzerConverterand its subclasses defined no_build_identifier, soprompt_templateandconverter_targetnever reached the identifier. Each request still recorded the converter per piece, so converters configured with different templates or targets shared one hash._build_identifierto the base class with a hash of the system prompt template and the converter target identifier.Fixes #3840