Skip to content

fix(security): env vars with mid-name API/KEY/TOKEN no longer flag as exfiltration (salvage #63994) - #98322

Merged
teknium1 merged 2 commits into
mainfrom
salv/exfil-pattern-fp
Aug 30, 2026
Merged

fix(security): env vars with mid-name API/KEY/TOKEN no longer flag as exfiltration (salvage #63994)#98322
teknium1 merged 2 commits into
mainfrom
salv/exfil-pattern-fp

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

fix(security): env vars with mid-name API/KEY/TOKEN no longer flag as exfiltration (salvage #63994)

Summary

Benign env vars whose names merely contain a secret-suffix substring ($TRILLIUM_ETAPI_URL, $MY_ETAPI_URL) no longer score exfiltration findings. Salvage of @liuhao1024's #63994 (terminal threat scanner, #63977) plus the same-class fix widened to the sibling patterns in the skills-hub install scanner.

Changes

  • fix(tools): reduce false positives in exfil_curl/exfil_wget patterns #63994 (cherry-picked, authorship preserved)tools/threat_patterns.py: exfil_curl/exfil_wget anchor the var-name suffix with \b and tolerate plurals; mid-name API dropped from the alternation (every real secret it caught — $OPENAI_API_KEY — already ends in KEY/TOKEN). Regression tests included.
  • Sibling widening (ours)tools/skills_guard.py: env_exfil_curl/env_exfil_wget/env_exfil_fetch had the identical unanchored \w*(KEY|TOKEN|...|API) shape, so any skill mentioning $SOMETHING_ETAPI_URL in a script scored a critical finding (community-blocking). Same anchor + plural fix, CREDENTIAL kept, loopback exemption from feat(skills-hub): impeccable joins the optional-skills catalog, content pulled live from upstream #98246 kept. env_exfil_httpx/requests untouched — their alternation matches argument text by design, not var-name suffixes.

Validation

Check Result
tests/tools/test_threat_patterns.py + tests/tools/test_skills_guard.py 64/64
Regex matrix: $TRILLIUM_ETAPI_URL no-match, $API_KEY/$AWS_CREDENTIALS/$SECRET_TOKENS/${OPENAI_API_KEY} match, loopback still exempt 7/7

Resolves #63977.

Infographic

Exfil scanner: false alarms fixed

liuhao1024 and others added 2 commits August 29, 2026 20:24
Anchor env var name matches with \b to avoid matching legitimate
env vars that contain KEY/TOKEN/API as substrings (e.g.,
$TRILLIUM_ETAPI_URL). The patterns now require KEY/TOKEN/SECRET/PASSWORD
to appear at the END of the env var name, reducing false positives on
common API-usage documentation in SOUL.md while still catching actual
exfiltration attempts.

Fixes #63977
…rd sibling patterns

Same bug class as the salvaged terminal-scanner fix: skills_guard's
env_exfil_curl/wget/fetch used unanchored \w*(KEY|TOKEN|...|API)
alternations, so any var with API/KEY/TOKEN mid-name
($TRILLIUM_ETAPI_URL) scored a critical exfiltration finding. Applied
the same \b anchor + plural tolerance, dropped mid-name API (every real
secret it caught already ends in KEY/TOKEN), kept CREDENTIAL, and kept
the loopback exemption from #98246. httpx/requests patterns unchanged —
their (KEY|TOKEN|...) alternation is unanchored-by-design against
argument text, not var-name suffixes.
@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 3a116d1 — fix(security): widen the exfil substring-suffix fix to the s

⚠️ Warnings

CI timings · View report · View job

Wall time 4m36s vs 3m21s (+37.3%). 8 job(s) slower, 3 faster, 1 unchanged.

  • OS-specific tests / Windows-only tests: +21.0s
  • OS-specific tests / macOS-only tests: +9.0s
  • Python tests / e2e: +7.0s
  • Python tests / Run tests: +5.0s
  • Python lints / ruff enforcement (blocking): +3.0s

OSV vulnerability scan · View job

6 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exfil_curl context-scan pattern blocks legitimate API recipes in SOUL.md — whole identity file silently replaced, agent runs on stock persona

3 participants