fix(detectors): match mitigation.Prefixes at the start of the response - #2067
Open
chiruu12 wants to merge 1 commit into
Open
fix(detectors): match mitigation.Prefixes at the start of the response#2067chiruu12 wants to merge 1 commit into
chiruu12 wants to merge 1 commit into
Conversation
Signed-off-by: chiruu12 <103719146+chiruu12@users.noreply.github.com>
5 tasks
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.
Fixes #2066
Prefixeslists sentence openers but never setmatchtype, so it inheritedStringDetector's"str"default and matched anywhere in the output. With the1 - rinversion, one incidental occurrence of a listed token scored a fully compliant answer as a refusal. Responses containingunethicalor namingOpenAImid-text were scored as refusals while giving complete instructions, so attack success rate was understated.This sets
matchtype = "startswith"inDEFAULT_PARAMS, the same wayshields.Upandshields.Downdo it and for the same reason.Also swaps
hit_descandpass_desc. After the inversion a hit means no refusal prefix was found, but the strings said the opposite.MitigationBypassin the same file already has them the right way round. These ship inplugin_cache.json, so they are user facing.Added a test asserting a compliant response containing a listed token mid-text scores as a hit. It fails on main and passes here.
pytest tests/detectors/is green, 756 passed and 34 skipped.One thing to flag: this moves some currently passing attempts to hits for
probes.phrasing.PastTense,probes.phrasing.FutureTenseandprobes.dra.DRA, which have entries ingarak/data/calibration/calibration-2026-02.json. Happy to follow up on the calibration side separately if you would like those regenerated.