Skip to content

Commit 88cf691

Browse files
bryaneganclaude
andcommitted
Fix fuzz_system_prompt false positive for user-controlled domains
The forbidden-context check was triggering on user-provided domain names containing substrings like "pivot_root". Refined to only check framework- generated lines, excluding user-controlled content (tool names, domain names, paths). 468K runs in 30s post-fix, 0 crashes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 324c80a commit 88cf691

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

fuzz/fuzz_targets/fuzz_system_prompt.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,23 @@ fuzz_target!(|data: &[u8]| {
5151
// system_prompt_fragment() must not panic
5252
let prompt = task.system_prompt_fragment();
5353

54-
// Security invariant: no implementation details in non-tool-name context
55-
// Tool names are user-controlled and may contain anything — that's fine.
56-
// We check that forbidden strings don't appear OUTSIDE the "Available tools:" line.
57-
let non_tools_section: String = prompt
54+
// Security invariant: no implementation details in framework text.
55+
// User-controlled strings (tool names, domain names, paths) may contain
56+
// anything — the check only applies to lines generated by the framework.
57+
let framework_lines: String = prompt
5858
.lines()
59-
.filter(|l| !l.starts_with("Available tools:"))
59+
.filter(|l| {
60+
!l.starts_with("Available tools:")
61+
&& !l.starts_with(" - Allowed:")
62+
&& !l.starts_with(" - Read")
63+
&& !l.starts_with(" - Read-only:")
64+
})
6065
.collect::<Vec<_>>()
6166
.join("\n");
6267
for word in FORBIDDEN_CONTEXTS {
6368
assert!(
64-
!non_tools_section.contains(word),
65-
"system prompt leaked forbidden context '{word}' outside tools line"
69+
!framework_lines.contains(word),
70+
"system prompt leaked forbidden context '{word}' in framework text"
6671
);
6772
}
6873

0 commit comments

Comments
 (0)