Scanning agent skills in CI before install
Teams that let agents install ClawHub skills from a pull request, a bot message, or a one-line script eventually need the same control they already use for packages and containers: a gate that runs outside the agent and fails the job when the result is not acceptable. Scanning agent skills in CI before install is that gate. It is not a full security program. It is a practical check that turns a scanner verdict into an exit code a pipeline can act on, before the skill lands in a shared workspace. For what any static scan still misses, read What Ironheights cannot catch and the product limitations.
Public research makes the gate worth the few lines of YAML. Snyk's ToxicSkills study confirmed 76 malicious payloads by hand across 3,984 skills. Koi's ClawHavoc report found 341 malicious skills in one ClawHub audit. VirusTotal has described skill markdown that looks harmless until the workflow it asks for runs. Marketplace scanning helps at listing time; CI protects the copy your agents will actually load.
Why CI beats "ask the agent to scan it"
A security skill that runs inside the same agent it is checking shares tools, memory, and trust with every other skill. A hostile skill can skip the check, rewrite the summary, or talk the agent into ignoring a block verdict. That problem is covered in Why a security skill that runs inside the agent can be bypassed. CI (or any script you own) does not ask a model what the scan meant. It reads the process exit code.
| Path | Who interprets the result | Failure mode |
|---|---|---|
| Agent chat summary | The same agent under skill influence | Misreport, skip, or soft-pedal a block |
Manual npx on a laptop | A human who may forget under deadline | Inconsistent; no artifact for the next review |
| CI job with exit codes | The pipeline runner | Job fails; install step never runs |
Use the browser scanner for ad-hoc checks. Use CI when more than one person, bot, or environment can install skills.
What "before install" means in practice
"Before install" means the skill files exist as an artifact the job can read, and they are not yet copied into the agent's skills directory or loaded by a running OpenClaw process. Common patterns:
- Download to a staging path. Fetch a zip, git submodule, or ClawHub export into
./staging/<slug>/, never into~/.openclaw/skills/(or your team's equivalent) until the scan exits0. - Scan the staged tree. Point the CLI at that folder. Do not re-download from the marketplace for the gate; scan the bytes you are about to promote.
- Promote only on success. Copy or symlink into the live skills root only after the job succeeds. On failure, keep the staging folder as evidence and open a ticket.
If you already use npx ironheights safe-install <owner>/<slug>, treat that as an interactive or scripted install helper, not as a substitute for a CI record. Safe-install still depends on a clean scan of the fetched copy; your pipeline should keep the JSON or SARIF output next to the pull request.
Minimal CI shape (GitHub Actions style)
The exact syntax varies by host. The shape does not: install Node, stage the skill, run the scan with machine-readable output, and fail on the severities you care about.
name: skill-gate
on:
pull_request:
paths:
- "skills/**"
- ".github/workflows/skill-gate.yml"
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- name: Scan staged skills
run: |
set -euo pipefail
for d in skills/*/; do
npx --yes ironheights scan "$d" --json --sarif "sarif/$(basename "$d").sarif" --fail-on high
done
- uses: actions/upload-artifact@v4
if: always()
with:
name: skill-scan-sarif
path: sarif/
Replace skills/*/ with whatever staging path your team uses. The important flags are real CLI options: --json for a schema-backed report, --sarif for code-scanning uploads, and --fail-on so the process exits non-zero when findings reach the severity you chose. Pair this with a human 10-minute vet checklist for first-time skills; CI does not replace reading SKILL.md.
Exit codes and verdicts your job should honor
Ironheights scan ends with a verdict and an exit code a script can branch on:
| Exit | Verdict (typical) | Suggested CI behavior |
|---|---|---|
0 | no-findings | Allow promote / merge of the skill change |
1 | review | Fail by default, or allow only with an explicit waiver file |
2 | block | Always fail; do not install |
3 | incomplete | Always fail until skipped files are handled |
64 | usage / config error | Fail; fix the job, not the skill |
--fail-on high (or critical) is how many teams turn "review findings above a threshold" into exit 1 without waiting for a human to read stdout. Treat incomplete (exit 3) as a stop: a padded README or skipped directory means the scan did not finish, not that the skill is clean. Raising limits.maxFileBytes or acknowledging directories in ignoreDirs with a written reason is a deliberate choice, not a silent default. Details live on the limitations page and in the benchmark write-up of what our own tests measure.
Rules that often fire in install gates
When a CI scan fails, the report names rule ids. These show up often on skills that try to run install-time commands or reach sensitive paths:
- IH-EXEC-001 — remote content piped into a shell or interpreter (curl-pipe teardown)
- IH-EXEC-002 — prerequisite install from an external URL (fake prerequisite anatomy)
- IH-CRED-001 — access to a sensitive path
- IH-NET-001 — undeclared network destination
- IH-OBF-001 — obfuscated blobs
- IH-INJ-001 — instruction override patterns
- IH-BIN-001 — bundled executable or archive
Keep a short allowlist policy for false positives you accept: skill slug, rule id, file, line, reason, and expiry. Do not paste a blanket "ignore all review" flag into every job.
Checklist: CI gate for agent skills
Use this when you add or change the pipeline:
- [ ] Skills land in a staging path first; live skills root is write-protected in the job
- [ ]
npx ironheights scan ./path/to/skillruns on every staged change - [ ]
--fail-onmatches team policy (oftenhighorcritical) - [ ] Exit
2and exit3always fail the job - [ ] SARIF or JSON is uploaded as an artifact on every run
- [ ] First-time skills also get a human checklist pass
- [ ] Waivers require a written reason and an owner
- [ ] After a bad install slips through, follow the incident playbook
Pair CI with hardening, not instead of it
A green skill gate does not fix an open gateway, plaintext tokens in config, or sandbox disabled while tools can act. Those are host and policy problems. Work through Hardening an OpenClaw install in parallel: loopback bind, real gateway auth, tight DM and group policy, secrets out of plaintext, and known skill load paths. Ironheights config rules such as IH-CFG-001 through IH-CFG-009 can flag several of those settings when you point the scanner at config, but they do not replace network isolation or a secret manager.
Integrity after install still matters. A skill that was clean on Monday can change on Wednesday. Record a baseline and run verify from a job the agent does not control; see Baselines for agent files. The tracker is useful when you are watching public reports over time, not as a substitute for scanning the bytes in your repo.
What CI scanning cannot prove
Be explicit with stakeholders so a green badge does not become a false comfort:
- Runtime-only behavior. The scanner does not execute the skill. Behavior that appears only after the agent follows natural-language steps may never match a file rule.
- Payloads behind links. A finding may show a URL; the job does not fetch the remote page. Linked second stages stay unread.
- Novel obfuscation and social engineering. Fixed rules miss wording that has never been seen, and they cannot stop a human who pastes a secret into chat anyway.
- Marketplace drift after your gate. You scanned the staged copy. A later ClawHub edit is a new artifact; re-run the gate on update.
Ironheights does not claim complete detection. A no-findings result means no published rule matched the files you scanned. Combine the gate with least privilege, short-lived credentials, and the habit of rotating keys when something looks wrong. For ongoing public advisory context, watch the tracker and re-scan when a skill you already run is mentioned.
Soft next step
If you want one command to try locally before you wire CI, run npx ironheights scan ./path/to/skill on a staged folder and confirm you see a verdict and exit code you can script. Product pages and docs live at ironheights.dev. Keep the pipeline boring: stage, scan, fail closed on block and incomplete, promote only on success.
FAQ
Should every pull request that touches skills run a scan?
Yes, if those files can reach a shared agent. Path filters that skip skills/** defeat the gate. Optional skills used only in a disposable sandbox can use a lighter job, but still keep exit 2 and 3 as hard failures.
Is VirusTotal on ClawHub enough without CI?
Marketplace scanning is useful at listing time and catches many known bad samples. It does not prove the copy in your repo or container matches what you reviewed, and it does not produce an exit code for your install job. Use both: marketplace signals plus a local or CI scan of the staged tree. A fair comparison of upload-based scanning versus local skill-aware scanning belongs on the product compare pages when you evaluate vendors.
What should we do on a review verdict in CI?
Default to fail, attach the SARIF, and require a human waiver with rule id, file, and expiry. Auto-merging review teaches the team to ignore the gate. If the finding is clearly a documentation false positive, record the waiver next to the skill, not as a global --fail-on downgrade.
Can the agent run the CI job for us?
Prefer a runner the agent cannot edit. If the agent can change workflow YAML or suppress artifacts, the gate is theater. Same rule as in-agent scanners: the trusted interpreter of the result must sit outside the agent's control plane.
Does a green CI scan mean the skill is safe to trust forever?
No. Re-run on every update, keep baselines for silent tampering, and assume runtime and remote content remain out of scope. Link stakeholders to limitations when they ask for a guarantee the product does not make.