greglas75/zuvo/container-audit
Claude Code and agent skill by greglas75/zuvo
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Static Docker/container security audit across 6 dimensions (K1-K6): base image provenance and pinning, privilege and runtime hardening, secret and build-context hygiene, image minimalism and attack surface, known-vulnerability scan (Trivy/Grype), and compose/orchestration hardening. Static-first — parses Dockerfile, Containerfile, and docker-compose (incl. override/merge files) with zero Docker and zero network; the CVE dimension (K5) runs Trivy/Grype only when present, else degrades to N/A. Reserved dimensions K7-K10 (Kubernetes) activate behind --k8s. HEALTHY/NEEDS ATTENTION/AT RISK/CRITICAL grade with critical gates. Distinct from infra-audit (live host daemon over SSH) and ci-audit (Docker build speed in the pipeline). Switches: zuvo:container-audit full | [path] | --static | --scan | --dockerfile <p> | --compose <p> | --quick | --k8s | --persist-backlog
Install
npx vskill@latest install greglas75/zuvo/container-auditSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as greglas75/zuvo/container-audit.
zuvo:container-audit
Audit container artifacts (Dockerfile, Containerfile, docker-compose) as code for security defects — running as root, mutable :latest bases, secrets baked into layers, bloated attack surface, known CVEs, and docker.sock mounts. Single-pass, read-only.
When to use: before shipping a Dockerized service, after editing a Dockerfile or compose file, periodic container hardening review, pre-deploy gate. When NOT to use: auditing the live Docker daemon on a remote host over SSH (zuvo:infra-audit IS9); Docker build speed / cache in CI (zuvo:ci-audit CI8); application-code vulnerabilities (zuvo:security-audit).
Mandatory File Loading
Read every file below before starting. Print the checklist.
If any file is MISSING, STOP. Do not proceed from memory.
Argument Parsing
| Token | Behavior | |
|---|---|---|
_(empty)_ or full | All applicable dimensions, scope = project root | |
[path] | Scope to a directory (monorepo package / service) | |
--static | Force pure-static: skip live Trivy/Grype even if present (K5 via trivy config or N/A) | |
--scan | Force live CVE scan; missing scanner OR declined image pull → exit non-zero (scan aborted), never a silent downgrade | |
--dockerfile <path> | Audit a single Dockerfile | |
--compose <path> | Audit a single compose file | |
--quick | Critical gates only (K1 + K2 + K3) | |
--k8s | Activate reserved dimensions K7-K10 (Kubernetes manifest/RBAC/Pod-Security/network-policy) | |
--persist-backlog | Record CRITICAL/HIGH findings via backlog-add |
Safety Gates
GATE 1 -- Read-Only
The only write targets are zuvo/audits/ and, through backlog-add, memory/backlog.md and memory/findings/. FORBIDDEN: modifying any Dockerfile, compose, or source file; building, running, tagging, or pushing images.
GATE 2 -- Secret Censorship
Any secret value — from ANY source (an ENV/ARG/.env, a hardcoded literal in a RUN command, a compose environment: entry, a scanned config) — is replaced with *** before it reaches the report. Variable NAMES may show; VALUES never. .env.example placeholders may show as-is.
GATE 3 -- Consent Before Any Image PULL
trivy config and the native Dockerfile/compose parse run freely (no pull). Before any trivy image <ref> / grype <ref> that must PULL an image, prompt: Pull image <ref> to scan for CVEs? This performs network egress to <registry>. [y/N] — default DENY. In a non-interactive / CI context (no TTY, no way to answer) do NOT prompt — treat it as an automatic DENY. Decline (or non-interactive) → default mode: K5 falls back to trivy config/native with an annotation; --scan mode: exit non-zero. The prompt (or the non-interactive auto-deny) and the outcome are logged.
GATE 4 -- No Daemon / Socket Interaction
The audit never connects to /var/run/docker.sock or a remote daemon (that is zuvo:infra-audit). Detecting a docker.sock mount in a compose file (K6) is static text analysis, not a socket connection.
MANDATORY TOOL CALLS — Container Audit Validity Gate
INVALID if any tool below is skipped. "DEFERRED", "N/A", --quick are NOT valid reasons.
| Tool | Trigger | Skip allowed? | |
|---|---|---|---|
get_file_tree | Always | NO — discover Dockerfile/compose/.dockerignore | |
search_text | Always | NO — FROM/USER/COPY/ARG/ENV/mount scan | |
search_patterns | Always | NO — K2/K3/K6 anti-patterns | |
scan_secrets | Always | NO — K3 baked-secret detection | |
audit_scan | Always | NO — compound check |
The gate checks the CHECK was PERFORMED, not that a specific CodeSift tool was literally invoked. When CodeSift is genuinely unavailable, the equivalent Glob/Read/grep fallback SATISFIES the gate (record scan_secrets: grep-fallback(<N> hits), codesift: unavailable). What is REJECTED is a check silently NOT DONE: scan_secrets: skipped, codesift: unavailable used as an excuse to run NO secret scan at all, or retrospective: skipped.
VERDICT vs logging: the audit VERDICT (PASS/WARN/FAIL/INCOMPLETE) is independent of the postamble log-append. "append-runlog exit 0" below means the log wrapper returned 0 (append succeeded) — a FAIL audit still appends its run line and returns 0 from the wrapper; the VERDICT is FAIL, not the exit code. A --scan abort (GATE 3) exits BEFORE the postamble and does not write a run line.
POSTAMBLE (on a completed audit): report on disk → retro appended → ~/.zuvo/append-runlog returns 0. Every finding needs path/to/file:LINE (verify-audit gate).
Degraded mode (CodeSift unavailable): fall back to Glob/Read/grep for artifact discovery and pattern scans; note codesift=unavailable in telemetry and proceed — the fallback satisfies the mandatory-tools gate (above), do NOT block.
Phase 0: Detect and Scope
0.1 Target Resolution
Set TARGET_ROOT from arguments. All subsequent scans use this path.
0.2 Artifact Discovery
Enumerate container artifacts (use get_file_tree; cross-check with git ls-files):
| Pattern | Kind | |
|---|---|---|
Dockerfile*, *.dockerfile, Containerfile | image build | |
docker-compose*.y{a,}ml, compose*.y{a,}ml | compose | |
docker-compose.override.y{a,}ml, compose.override.y{a,}ml | compose override (merged into effective config) | |
.dockerignore | build-context filter | |
*.yaml/*.yml under k8s/, kubernetes/, manifests/ | Kubernetes (K7-K10, only when --k8s) |
If NO container artifacts are found → report "no container artifacts" and exit HEALTHY (N/A — nothing to audit). This is not a failure. Note: get_file_tree HAS run at this point (that is how "none found" was determined, satisfying the mandatory-tools gate for it); the remaining artifact-scanning tools (search_text/search_patterns/scan_secrets over Dockerfiles) are vacuously N/A because there is nothing to scan — record them as N/A(no-artifacts), not skipped.
0.3 Scanner and Socket Detection
command -v trivy/command -v grype→ K5 mode (live vs N/A).- Note Docker socket presence only to decide whether an image pull is even possible; never connect.
Print:
Phase 1: Dimension Analysis (K1-K6, + reserved K7-K10)
Single-pass inline execution. No sub-agents.
Multi-stage scope rule: runtime dimensions (K2, K4, K6) are judged on the FINAL stage only — root/tools in a builder stage is fine. K1 (pinning) and K5 (CVE) apply to every EXTERNAL base ref in ALL stages (a FROM node:latest AS builder is still pulled → supply-chain risk). INTERNAL stage refs (FROM builder, where builder is a prior stage in the same file) are exempt.
K1: Base Image Provenance & Pinning -- Weight 15, Critical Gate
| Check | Good | Bad | Severity | |
|---|---|---|---|---|
| Base fully pinned | @sha256:… digest (immutable) | :latest, :stable, or no tag | CRITICAL | |
| Version tag (no digest) | node:20.11.1 — acceptable but MUTABLE (a tag can be re-pushed) | — | MEDIUM (recommend adding @sha256:) | |
| Trusted registry | Official / org registry | Unknown/anonymous registry | HIGH | |
| Every stage's external base | All pinned | A builder stage on :latest | HIGH | |
Var-interpolated FROM $REG/img | Resolvable + pinned | Unresolvable build-arg base | HIGH (flag, do not silent-pass) |
Only a @sha256: digest is truly immutable; a specific version tag is pinned-enough to clear the critical gate but is flagged MEDIUM (recommend a digest). Critical gate: any final-image external base on :latest/:stable/no-tag → FAIL. The gate fires on that FINDING; a K1 score of 0 also fires it but is not required. rule_ids: K1-latest-tag, K1-no-tag, K1-mutable-version-tag, K1-untrusted-registry, K1-unpinned-builder.
K2: Privilege & Runtime Hardening -- Weight 18, Critical Gate
| Check | Good | Bad | Severity | |
|---|---|---|---|---|
| Non-root user | USER <non-root> in final stage (or distroless :nonroot) | No USER → runs as root | CRITICAL | |
Compose user: override | absent, or a non-root uid | compose user: root/user: "0" overriding the image's non-root USER back to root | CRITICAL | |
| Privileged (compose) | privileged: false / absent | privileged: true | CRITICAL | |
| Capabilities (compose) | cap_drop: [ALL] + minimal cap_add | No cap_drop / cap_add: [ALL] | HIGH | |
| no-new-privileges (compose) | security_opt: [no-new-privileges:true] | absent | MEDIUM | |
| Read-only rootfs (compose) | read_only: true where feasible | writable rootfs unnecessarily | MEDIUM |
Distroless :nonroot variants satisfy the non-root check even without a USER line — do NOT false-flag them. Critical gate: the image runs as root AND/OR privileged: true → FAIL. The gate fires on that FINDING; a K2 score of 0 also fires it but is not required. rule_ids: K2-root-user, K2-privileged, K2-no-cap-drop, K2-no-new-privileges.
K3: Secret & Build-Context Hygiene -- Weight 18, Critical Gate
| Check | Good | Bad | Severity | |
|---|---|---|---|---|
| No secret in ENV/ARG | Config-only ENV/ARG | ENV API_KEY=… / ARG SECRET=… baked to a layer | CRITICAL | |
| Build secrets | RUN --mount=type=secret | secret passed via ARG (persisted in history) | CRITICAL | |
.dockerignore present | excludes .env, .git, keys | absent with a blind COPY . . | CRITICAL | |
| No hardcoded creds | secrets via runtime env / manager | literal password/token in Dockerfile | CRITICAL |
K3 only flags ENV/ARG whose NAME matches secret patterns (*KEY*, *SECRET*, *TOKEN*, *PASSWORD*, *CRED*), never benign build config (VERSION, NODE_ENV). Critical gate: any secret baked into the image, OR a blind COPY . . with no .dockerignore → FAIL. The gate fires on that FINDING; a K3 score of 0 also fires it but is not required. rule_ids: K3-secret-in-env, K3-secret-in-arg, K3-no-dockerignore, K3-hardcoded-cred.
K4: Image Minimalism & Attack Surface -- Weight 12
| Check | Good | Bad | Severity | |
|---|---|---|---|---|
| Multi-stage | builder + slim runtime | single fat stage shipping build tools | HIGH | |
| Minimal base | distroless / -slim / alpine | full ubuntu/node (non-slim) for runtime | MEDIUM | |
| Package-manager cache | --no-cache / rm -rf /var/lib/apt/lists | apt/apk cache left in a layer | MEDIUM | |
| No dev/debug tools in final | prod image has no curl/nc/shell (distroless) | debug tooling shipped to prod | MEDIUM |
rule_ids: K4-no-multistage, K4-fat-base, K4-pkg-cache, K4-debug-tools.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/container-audit/SKILL.md
Popularity
- Repository stars
- 8
- 7-day trend score
- 11
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/greglas75/zuvo/container-audit)