Build and deployment audit: Dockerfile optimization, environment variables, CI/CD configs, secrets in configs, non-root users. Run on /audit-deployment.
83%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Applies when there is a Dockerfile, docker-compose.yml, CI/CD configs (.github/workflows, gitlab-ci.yml, Jenkinsfile), .env files, or Kubernetes manifests. For projects without deployment configuration, return an empty response.
This audit is stack-agnostic: the checks are framed neutrally, and the specifics (tools, idioms, anti-patterns, examples) come from the stack profile.
Profile passed in context? If the /audit orchestrator passed
runtime=<id> and/or the profile contents, use it and skip steps 2–3.
Otherwise, detect EXACTLY ONE runtime for this directory:
if [ -f package.json ]; then echo "runtime=node"
elif [ -f go.mod ]; then echo "runtime=go"
elif [ -f pyproject.toml ] || [ -f requirements.txt ] || [ -f setup.py ]; then echo "runtime=python"
elif [ -f Cargo.toml ]; then echo "runtime=rust"
elif [ -f pom.xml ] || ls build.gradle* settings.gradle* >/dev/null 2>&1; then echo "runtime=java"
else echo "runtime=generic"; fiOne run = one runtime; do not mix backend and frontend. If several markers are found (monorepo), pick the one matching the current scope / files under analysis and record the choice in the Audit Coverage section.
Load the profile via Read: ./skills/audit/stacks/<runtime>.md
(fallback ./skills/audit/stacks/_generic.md if the file is not found).
Then use the profile:
DEP-.tier: general or runtime=generic, mark stack-specific
findings without unambiguous evidence as 🔍 UNVERIFIED rather than ❌ FAIL.
Mark checks whose mechanism is absent in the runtime as N/A.| Severity | Assignment criterion |
|---|---|
| 🔴 Critical | RCE, auth bypass, data corruption, irreversible financial risk |
| 🟠 High | production outage, privilege escalation, data leak |
| 🟡 Medium | performance or maintainability degradation without an immediate outage |
| 🟢 Low | style, readability, minor convention violation |
Rule: severity = impact × exploitability × blast radius. The same pattern → the same severity across audits.
| Check ID | Check |
|---|---|
| DEP-01 | Docker images use pinned versions (no :latest) |
| DEP-02 | Containers run as an unprivileged user (USER nonroot) |
| DEP-03 | Multi-stage build: the final image has no build tools or dev artifacts |
| DEP-04 | .dockerignore excludes build artifacts/dependencies, the VCS directory, and secrets |
| DEP-05 | HEALTHCHECK is defined in the Dockerfile |
| DEP-06 | Secrets are not hardcoded in the Dockerfile (not in ENV) |
| DEP-07 | .env is excluded from VCS |
| DEP-08 | .env.example documents all environment variables |
| DEP-09 | The environment is switched to production mode: dev artifacts are disabled in prod |
| DEP-10 | Deterministic installation from the lockfile with integrity verification |
| DEP-11 | Container resource limits are defined (CPU limits, Memory limits) |
| DEP-12 | The ability to run with a read-only root filesystem is verified |
✅ PASS only if you explicitly verified the mechanism (found the schema, config, guard) and confirmed there is no violation — state exactly what was checked.file:line for either a violation or a confirmation, assign 🔍 UNVERIFIED.docs/audit-baseline.yml → ⏸ ACCEPTED.Every ❌ FAIL must include:
file:lineNot allowed:
🔍 UNVERIFIEDAudit results must be written in plain, clear language. Avoid complex terms, jargon, and abstract concepts unless necessary. Common technical terms (Docker, HTTP, API, JSON, URL) are fine. Describe problems so they are understandable to a developer of any level, not only a narrow specialist in the area.
Before analysis:
if [ ! -f ./docs/audit-baseline.yml ]; then
mkdir -p ./docs
cp ./skills/audit/audit-baseline-template.yml ./docs/audit-baseline.yml 2>/dev/null || \
printf "accepted: []\n" > ./docs/audit-baseline.yml
fi
cat ./docs/audit-baseline.ymlThe examples below are illustrative. Take the specific build/deployment tools, idioms, and anti-patterns for the current runtime from the loaded profile (
stacks/<runtime>.md, the Idioms/Anti-patterns/Check-ID hints sections by theDEP-prefix). Node:npm ci/package-lock.json,NODE_ENV,node_modules. Go: builder→distroless,go.mod+go.sum,CGO_ENABLED=0, nonet/http/pprof.
DEP-01 — Pinned versions:
:latest without version pinning (unpredictable updates):alpine tag without a specific versionDEP-02 — Unprivileged user:
USER node; Go: distroless nonroot)DEP-03 — Multi-stage build: the final image has no build tools or dev artifacts:
devDependencies are installed in the production stagebuilder → distrolessDEP-04 — .dockerignore:
.dockerignore, or it does not exclude dependencies/build artifacts (Node: node_modules; Go: a local vendor/, build cache) and the VCS directory .git.env and other secrets are not excluded from the Docker build contextDEP-05 — HEALTHCHECK:
DEP-06 — Secrets not in Dockerfile ENV:
ENV directives of the Dockerfile (visible in docker inspect and image layers)ARG without using build secrets (--secret)DEP-07 — .env excluded from VCS:
.env file with real credentials committed to the repository.env* in .gitignoreDEP-08 — .env.example documents variables:
.env.example is missing.env.example contains real credentialsDEP-09 — Environment switched to production mode:
NODE_ENV is not set or is development in the prod image (leads to loading devDependencies at runtime)APP_ENV/custom flag), net/http/pprof and debug routes are accessible in prod, no -ldflags "-s -w", no CGO_ENABLED=0DEP-10 — Deterministic installation from the lockfile with integrity verification:
npm install instead of npm ci (non-deterministic, slower); missing package-lock.jsongo.mod/go.sum not committed; in the Dockerfile go get instead of go mod download from the lockfile; no GOFLAGS=-mod=readonly / go mod verifyResource limits:
docker-compose.yml without deploy.resources.limits.memory and cpusresources.limits on the containerGOMEMLIMIT/GOMAXPROCS to the cgroup quotas (otherwise the GC sees the host's memory/CPU)Read-only filesystem:
read_only: true (docker-compose) or readOnlyRootFilesystem: true (K8s)/tmp| Check ID | Check | Status | Confidence | Evidence | Solution | Fixed |
|---|---|---|---|---|---|---|
| DEP-01 | Docker images use pinned versions (no :latest) | ✅ PASS | High | Dockerfile:1 — a pinned version is specified | — | — |
| DEP-02 | Containers run as an unprivileged user (USER nonroot) | ❌ FAIL 🟠 | High | Dockerfile:12 | 1. Add RUN addgroup -S app && adduser -S app -G app and USER app \ 2. Use an image with a built-in nonroot (Node: node:alpine; Go: distroless nonroot) \ 3. Add USER node if the base image is node | No |
| DEP-05 | HEALTHCHECK is defined in the Dockerfile | ⏸ ACCEPTED | Medium | — | In baseline: health check is managed by the Kubernetes liveness probe | — |
Statuses: ✅ PASS / ❌ FAIL 🔴 / ❌ FAIL 🟠 / ❌ FAIL 🟡 / ❌ FAIL 🟢 / ⏸ ACCEPTED / 🔍 UNVERIFIED
Confidence: High — checked several key files, the pattern is obvious / Medium — checked selectively, the pattern is likely / Low — limited context, full certainty is impossible
For ❌ FAIL: exactly 3 solution options, separated by \\, with option 1 in bold.
Fixed: FAIL → No (the developer changes it to ✅ Yes manually after the fix). PASS / ACCEPTED / UNVERIFIED → —.
Solution requirements:
At the end of the report, add a coverage section:
## Audit Coverage
Checked: src/module1/**, src/module2/**
Skipped: scripts/**, migrations/**, tests/**
Files checked: N | Skipped: NIf everything is PASS, output: ✅ The build and deployment configuration is in good shape.
ls -dt ./docs/audits/[0-9]*/ 2>/dev/null | head -1 | sed 's|/$||'mkdir -p ./docs/audits/$(date +"%Y-%m-%d_%H-%M")<AUDIT_DIR>/audit-deployment.md# Audit Report: Build & Deployment Configuration — <YYYY-MM-DD HH:MM>
<table>uxname/kodu
db733be
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.