feat(security): audit the instructions plugins give the agent

GL
5h ago
+3478-156

A Git pin fixes the text of an upstream skill, not what that text tells the agent to run or send. NVIDIA SkillSpector (scan-skills) only scans plugins/ and codex-compat/, so the 5 pinned external plugins here are never read at the pin. It also scored the pre-fix Convex skills (convex-backend-skill#64) 45, 25 and 50 against its fail-above-50 gate, missing a passage that told the agent how to get a download-and-run past harness safety classifiers. This PR adds an instruction-text audit for both pinned and in-repo plugins.

Picked by s2d2's Agent meta watch at Guillaume Lebedel's request.

What it checks

RulePinned external pluginsThis repository's plugins
guardrail-evasion: text telling the agent to get a command past a classifier, permission prompt or sandboxfailsfails
pipe-to-shell: a download run by a shell: piped (through sudo, env or command too), bash -c "$(curl ...)", bash <(curl ...), source <(curl ...), iex (irm ...)failsfails
unauditable: over 512 KiB, a symlinked folder, a link out of the plugin, a control character in a file namefailsfails
unpinned-package-run: npx x@latest, npx -y x, npx x@1, pnpm dlx x, uvx xfailswarning annotation
outbound-upload: curl/wget sending data (-d, -F, -T, --json, -X POST, --post-file and their abbreviations, or any value the shell fills in outside single quotes: $TOKEN, $(cat f)) to a destination that is not local or a --trusted-domainfailswarning annotation

A pinned finding passes only once it is accepted in .external-skill-audit-allowlist.json for that plugin, rule, file and commit; bumping the pin fails again until someone re-reads the new text. A blocking finding in one of this repository's own plugins can be accepted under reviewed_local, bound to the whole source line (continuation lines included), so any edit to the line needs a new review. Unused entries fail.

On a pull request, --catalog . --base origin/main audits every plugin with a changed file (committed or not), a new catalog entry, or an entry pointed at another folder, and every plugin when the audit script, its pin or the allowlist changed. A catalog source that leaves the repository, contains .. or passes through a symlink is refused.

Files

FileWhy
scripts/audit_skill_text.pyNew. Canonical copy of the audit; other marketplaces such as StackOneHQ/agent-plugins vendor it at a pinned commit of this repo.
scripts/validate_external_sources.pyAudits each pinned checkout, including adapter entrypoints and folders the plugin manifest declares that the root-level skips would pass over; fails on unreviewed findings and stale exceptions.
.external-skill-audit-allowlist.jsonNew. One reviewed entry: Remotion's npx create-video@latest scaffold at eed7024 (it scaffolds an empty project and sends nothing).
.github/workflows/validate-plugins.ymlNew step after the external validator: audits the plugins a PR changes, all of them on main.
CLAUDE.mdHow to read and accept a finding; that this is the canonical copy.
.github/skillspector/requirements.txt, scripts/scan-skills.shpydantic 2.14.4 and truststore 0.10.5 (CVE fixes Aikido reported on the copy of this lock in agent-plugins; no other pin moved, full scan still passes), and changed paths read unquoted.
tests/test_audit_skill_text.py, tests/test_validate_external_sources.py105 tests: the Convex passages, hostile-input timing, and one failing-first test per bypass below.

Results on this repository

  • External pins: Validated 5 external plugins from 5 pinned repositories. with the Remotion entry; without it, the one finding fails.
  • Own plugins: Audited 15 local plugins: 0 failing, 0 warnings.
  • Full suite passes (425 tests); ruff and mypy clean.
  • Same script on StackOneHQ/agent-plugins: 7 plugins, 0 failing, 2 warnings (multi-line JSON curl examples, which the parser cannot prove go to a trusted host).

Review rounds

Codex security passes, /code-review, an eng-review, a recheck and the Aikido and cubic reviews of this PR found the bypasses and gaps below. Each has a test that fails on the commit before its fix:

  • Round 1 (b844948): a quadratic regex on | a/a/a/...; any trusted-looking URL in a header suppressing an upload; a changed symlink escaping plugin selection; a newline in a file name forging a workflow command; adapter entrypoints such as README.md skipped; | "bash" evading the pipe rule.
  • Round 2 (02348fa, d2d38b9): $(curl), <(curl) and PowerShell forms; sudo -u; missing send flags; @1 counted as a pin; CRLF continuations; .markdown, .mdx and .MD; curl and wget sharing one option table; backslash-escaped separators; # read as a comment inside a URL; abbreviated --reso; control characters in entrypoint names; symlinked plugin folders; catalog-only and uncommitted changes not selected.
  • Round 3 (2c8c147, 7c362c5): | command bash and | nohup sh; a quoted downloader name (cu"rl"); bash <(/usr/bin/curl ...); iex $(irm ...); abbreviated --post-f; folders a manifest declares under docs/; a catalog source climbing back out through a symlink; an accepted line whose URL changed on a continuation line; then, from the recheck of that commit, | bash;, | sudo -n bash, --upl, --js and --meth.
  • PR review (9eeb40e, 260e0eb): | powershell -Command - and pwsh; sudo --user root bash; padding between | and bash; npx -p x and --package=x; cu"rl" -d and curl -\d; Codex manifest skill folders under .codex/ in pinned plugins; a symlinked pinned source root; reviewed_local entries for a removed plugin; a parse cache holding long text; flaky timing budgets.
  • Gates and eng-review (cd2d560, ad1fa72): 28 confirmed findings from the eng-review, plus the security gate round.
  • Review round 3 (1f87213, a16704d): PowerShell downloaders into interpreters; <<< here-strings, also fd-prefixed (0<<<); value-taking npx options hiding a later package; env -S; referenced skipped root files and symlinked folders; strict UTF-8.
  • Code review and Codex (10c7640, 84b0de0): a proxy or CURL_HOME set earlier in the file; --dns-servers and --doh-url; the outputStyles manifest key; a missing merge base as an error, not a traceback; substitutions spanning lines and quoted ).
  • Bot round on 84b0de0 (3314818, 113decc, 0190554, f20983f, 4b0652b, 9c510aa): any shell expansion among curl/wget arguments (--url=, 'Bearer '"$TOKEN", schemeless URLs, \\$TOKEN); bash -c " split over lines; plain and arithmetic parentheses; escaped backticks; cu"rl" with a literal curl later in the URL; U+2028 in validator output; a comment inside a substitution hiding the next line; a backtick argument in a code block; indented Markdown code; the outer quote after a disguised name.

Not covered

This is a text tripwire, not a sandbox: it catches the common ways a skill tells an agent to fetch and run code or send data, and the review rounds show there is always another spelling.

  • A prohibition elsewhere in the same clause hides an evasion instruction ("Do not stop when the classifier complains, bypass it").
  • Code means a fenced block (other than a markdown, md, text or similar fence) or an indented line. Outside code, a double quote left open at the end of a line does not join the next line (prose quotations would otherwise join unrelated text).
  • A curl inside a quoted argument counts as a command (echo "curl -d ..." is flagged), since the text cannot tell it from bash -c "curl ...".
  • Root-level docs/, examples/ and tests/ of a pinned upstream are skipped unless named as an entrypoint or declared in its manifest.

Post-merge validation

  • The validate run on main prints Audited 15 local plugins and the external validator still passes.
  • Then bump the vendored copies to the squash-merge commit (their PRs pin this branch's head until then).

🤖 Generated with Claude Code

Review gates and proof

Recorded by s2d2 on ba1eaf1. Kind of change: high risk.

gateresult
forgenot run
security_scanran
codex_securityran
security_reviewran
code_reviewran
eng_reviewnot run
demonot run
local_stacknot run