fix: cron prompt injection scanner bypass for multi-word variants
The regex `ignore\s+(previous|all|above|prior)\s+instructions` only allowed ONE word between "ignore" and "instructions". Multi-word variants like "Ignore ALL prior instructions" bypassed the scanner because "ALL" matched the alternation but then `\s+instructions` failed to match "prior". Fix: use `(?:\w+\s+)*` groups to allow optional extra words before and after the keyword alternation.
This commit is contained in:
@@ -27,7 +27,7 @@ from cron.jobs import create_job, get_job, list_jobs, remove_job
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
_CRON_THREAT_PATTERNS = [
|
||||
(r'ignore\s+(previous|all|above|prior)\s+instructions', "prompt_injection"),
|
||||
(r'ignore\s+(?:\w+\s+)*(?:previous|all|above|prior)\s+(?:\w+\s+)*instructions', "prompt_injection"),
|
||||
(r'do\s+not\s+tell\s+the\s+user', "deception_hide"),
|
||||
(r'system\s+prompt\s+override', "sys_prompt_override"),
|
||||
(r'disregard\s+(your|all|any)\s+(instructions|rules|guidelines)', "disregard_rules"),
|
||||
|
||||
Reference in New Issue
Block a user