Validation command allowlist gate
Skill kjuhwa/skills-hub/skills/security/validation-command-allowlist-gate
Before executing an "arbitrary" validation command supplied by data (plugin config, ingested asset, user rule), pass it through a layered allowlist that rejects anything outside a known-prefix whitelist, substitution syntax, or shell operators, and then run it scoped and time-bound.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill validation-command-allowlist-gateAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.7 KB, 489 tokens by cl100k_base, as published. Nobody here has run it
Validation Command Allowlist Gate
Problem
You accept "validation" or "precheck" commands from config files / ingested assets / plugin manifests, then execute them. Without gating, that's arbitrary RCE at the trust boundary.
Gate (apply in order; any failure = reject)
- Prefix whitelist — the stripped command must start with an exact token from a small set, e.g.
node,npm,npx. No regex globs; exact word match followed by whitespace or end-of-string. - No command substitution — reject if the raw string contains
`or$(anywhere. Do this on the raw input; do not try to "escape" it. - No shell operators (after quote stripping) — strip single- and double-quoted substrings, then reject if
;,&,|,>,<appears. Stripping quotes first prevents false positives on literal flags like--match=">=1.0". - Timeout — each command runs with a hard wall clock cap (e.g. 180s). Kill the process tree on expiry.
- Scoped cwd — run with
cwdexplicitly set to the project/repo root; never inherit the parent's cwd. - No shell — spawn with
shell: falseand split the command intoargv, so no reinterpretation happens at exec time.
Promotion rules for ingested assets
When validation commands arrive from an external source (a2a ingest, hub sync, user-pasted config):
- Stage in an isolated candidate zone first; never execute during ingest.
- Require an explicit
--validatedflag / human confirmation before promoting the asset into the active store. - Re-audit the validation commands at promotion time (the gate above), and reject promotion if any command fails the gate — the whole asset, not just the command.
- Never overwrite an existing asset with the same ID (no silent replacement).
Anti-patterns
- "Just escape the string." Quoting rules differ by shell; the safe move is to never hand the string to a shell.
- Letting the command run
bash -c. That defeats every layer above. - Treating the allowlist as a denylist. Denylists always leak.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.