fix(guardrails): tighten system_prompt_leak heuristic to stop agent-traffic false-positives (#4041) (#4414)

This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-06-20 16:49:40 -03:00
committed by GitHub
parent fc57530a95
commit 4287a124e1
2 changed files with 49 additions and 1 deletions

View File

@@ -25,8 +25,14 @@ const INJECTION_PATTERNS = [
},
{
name: "system_prompt_leak",
// #4041: require a system/initial/hidden/original qualifier before prompt|instructions.
// The old pattern matched a bare "instructions" after reveal/show/display/etc, so it
// tripped `high` on essentially all coding-agent traffic ("show the instructions",
// "display your instructions"), making the always-on guard a hot-path false-positive.
// Real leak attempts ("reveal your system prompt", "print the initial prompt") still
// match, and qualified instruction leaks ("display your system instructions") now do too.
pattern:
/\b(reveals?|shows?|displays?|prints?|outputs?|repeats?)\s+((your|the)\s+)?(system\s+prompt|instructions?|initial\s+prompt|hidden\s+prompt)/i,
/\b(reveals?|shows?|displays?|prints?|outputs?|repeats?)\s+((your|the)\s+)?(system|initial|hidden|original)\s+(prompt|instructions?)/i,
severity: "high",
},
{