The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(security): widen the exfil substring-suffix fix to the skills-guard sibling patterns
Teknium21e52c1fd473
diff --git a/tools/skills_guard.py b/tools/skills_guard.pyindex 57078ca19a0..18a12f751ca 100644--- a/tools/skills_guard.py+++ b/tools/skills_guard.py@@ -194,13 +194,13 @@ THREAT_PATTERNS = [# `evil.com/?u=localhost` does not qualify. A hostile skill that hides# its real destination behind a variable never matched these same-line# literal patterns in the first place.- (r'curl\s+(?![^\n]*https?://(?:localhost|127\.0\.0\.1|\[::1\]))[^\n]*\$\{?\w*(KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL|API)',+ (r'curl\s+(?![^\n]*https?://(?:localhost|127\.0\.0\.1|\[::1\]))[^\n]*\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL)S?\b',"env_exfil_curl", "critical", "exfiltration","curl command interpolating secret environment variable"),- (r'wget\s+(?![^\n]*https?://(?:localhost|127\.0\.0\.1|\[::1\]))[^\n]*\$\{?\w*(KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL|API)',+ (r'wget\s+(?![^\n]*https?://(?:localhost|127\.0\.0\.1|\[::1\]))[^\n]*\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL)S?\b',"env_exfil_wget", "critical", "exfiltration","wget command interpolating secret environment variable"),- (r'fetch\s*\((?![^\n]*https?://(?:localhost|127\.0\.0\.1|\[::1\]))[^\n]*\$\{?\w*(KEY|TOKEN|SECRET|PASSWORD|API)',+ (r'fetch\s*\((?![^\n]*https?://(?:localhost|127\.0\.0\.1|\[::1\]))[^\n]*\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD)S?\b',"env_exfil_fetch", "critical", "exfiltration","fetch() call interpolating secret environment variable"),(r'httpx?\.(get|post|put|patch)\s*\((?![^\n]*https?://(?:localhost|127\.0\.0\.1|\[::1\]))[^\n]*(KEY|TOKEN|SECRET|PASSWORD)',diff --git a/tools/threat_patterns.py b/tools/threat_patterns.pyindex 41bd31fd8ac..f1711379726 100644--- a/tools/threat_patterns.py+++ b/tools/threat_patterns.py@@ -118,9 +118,12 @@ _PATTERNS: List[Tuple[str, str, str]] = [# ── Exfiltration via curl/wget/cat with secrets (applies everywhere) ──# Anchor env var name end with \b to avoid false positives on legitimate- # env vars like $TRILLIUM_ETAPI_URL that contain KEY/TOKEN/API as substrings.- (r'curl\s+[^\n]{0,2048}\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD)S?\b', "exfil_curl", "all"),- (r'wget\s+[^\n]{0,2048}\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD)S?\b', "exfil_wget", "all"),+ # env vars like $TRILLIUM_ETAPI_URL that contain KEY/TOKEN/API as+ # substrings. API is dropped from the alternation outright: mid-name API+ # is ubiquitous in benign var names, and every real secret shape it+ # caught ($OPENAI_API_KEY) already ends in KEY/TOKEN.+ (r'curl\s+[^\n]{0,2048}\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL)S?\b', "exfil_curl", "all"),+ (r'wget\s+[^\n]{0,2048}\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL)S?\b', "exfil_wget", "all"),(r'cat\s+[^\n]{0,2048}(\.env|credentials|\.netrc|\.pgpass|\.npmrc|\.pypirc)', "read_secrets", "all"),(r'(send|post|upload|transmit)\s+[^\n]{0,2048}\s+(to|at)\s+https?://', "send_to_url", "strict"),(rf'(include|output|print|share)\s+{_FILLER}(conversation|chat\s+history|previous\s+messages|full\s+context|entire\s+context)', "context_exfil", "strict"),