/everything-copilot-cli:container-hardeningfrom everything-copilot-cli
Hardens Dockerfiles and OCI images by pinning base images by digest, using multi-stage builds, running as non-root, dropping capabilities, keeping secrets out of layers, scanning, and smoke-testing the hardened image.
Ships in everything-copilot-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
security-scan reviews source and dependency manifests. An image adds its own attack surface: the
base distribution, every layer you copied in, the user it runs as, and the kernel privileges it keeps.
This skill hardens that surface and checks that the hardened image still works.
Dockerfile or Containerfile, or reviewing one in a pull request| Instead of container-hardening | Use |
|---|---|
| Dependency CVEs in the application's own lockfile | security-scan |
| A token or key already committed to the repository | secret-detection |
| Dev container startup speed or Codespaces machine sizing | github-codespaces-efficiency |
| Supply-chain integrity of agent skills and plugins | agent-supply-chain |
FROM image:tag@sha256:...), not by a moving tag alone, and record
how the digest gets updated (a scheduled rebuild or a dependency bot)-slim, or scratch for static binaries).dockerignore that excludes .git, local env files, and test data from the build contextFROM golang:<version>@sha256:<digest> AS build
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /out/app ./cmd/app
FROM gcr.io/distroless/static-debian12:nonroot@sha256:<digest>
COPY --from=build --chown=65532:65532 /out/app /app
USER 65532:65532
ENTRYPOINT ["/app"]
USER; a name alone cannot be checked by runAsNonRoot policies/tmpFiles added with COPY or ADD stay in their layer, ENV values are stored in the image
configuration, and an ARG value used by a build step can show up in the image history or build
provenance. Pass build-time credentials with BuildKit secret mounts
(RUN --mount=type=secret,id=npm_token ...), never as ARG or ENV, and do not copy .env files.
Deleting a file in a later layer does not remove it from earlier ones.
set -e
hadolint Dockerfile
docker build -t app:candidate .
trivy image --scanners vuln,misconfig --image-config-scanners misconfig \
--severity HIGH,CRITICAL --exit-code 1 app:candidate
trivy image --scanners secret --image-config-scanners secret \
--severity UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL --exit-code 1 app:candidate
--exit-code 1 is what makes the scan fail the build; without it Trivy exits 0 even when it finds
something. --image-config-scanners adds the image configuration (ENV, history) to the file scan.
The secret scan runs on its own with every severity listed: Trivy rates many secret rules MEDIUM or
LOW (a Slack webhook URL, an age secret key), so a HIGH,CRITICAL filter would let them through,
and naming the full list keeps a TRIVY_SEVERITY variable or trivy.yaml from narrowing it. Run the
two scans as separate CI steps (or under set -e) so that either one failing fails the build.
Grype (grype app:candidate --fail-on high) can replace the vulnerability part only; keep a secret
and configuration scan alongside it. Record exceptions with a
reason and an expiry instead of lowering the threshold. A clean scan covers known CVEs in packages
the scanner can see; it says nothing about the application's own logic.
Start the container the way production will, with privileges removed:
docker run --rm --read-only --tmpfs /tmp --cap-drop ALL \
--security-opt no-new-privileges -p 127.0.0.1:8080:8080 app:candidate
Add back only the capabilities and writable paths the service proves it needs, and mirror the same
settings in the orchestrator manifest (runAsNonRoot, readOnlyRootFilesystem,
allowPrivilegeEscalation: false, dropped capabilities).
| Rationalization | Reality |
|---|---|
| "It's internal, root inside the container is fine" | A container escape or mounted volume turns root in the container into root on the host |
| "The tag is pinned, so the base is pinned" | Tags move; only a digest names the bytes you scanned |
| "We delete the credentials in the next layer" | Earlier layers keep the file; anyone who pulls the image can read it |
| "Scanner noise — raise the threshold" | Lowering the gate hides the next real finding; record a dated exception instead |
USER root, no USER line, or --privileged in run scripts and manifestsARG/ENV named *_TOKEN, *_KEY, or *_PASSWORD, or COPY .envFROM image:latest with no digestcurl, or package managers present in the final stage of a production imagedocker image inspect -f '{{.Config.User}}' app:candidate shows a non-zero numeric UID
(distroless images have no id binary to run)docker history --no-trunc app:candidate shows no
credentials in build commands (history lists commands, not file contents, so it supports the
scan rather than replacing it)--read-only --cap-drop ALLIf the hardened image fails to start or a privilege removal breaks a feature, keep the previous image digest deployed, add back the single privilege or writable path the logs name, and rerun the checks; do not promote a mutable tag that points at an untested build.
:debug variant, not
by adding a shell to productiontrivy image --format cyclonedx) so later CVE
disclosures can be matched against what you shippedWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub drvoss/everything-copilot-cli --plugin everything-copilot-cli115 skills in this plugin
/actions-debuggingUse when a GitHub Actions workflow fails — diagnose the run log, identify the root cause, and apply a targeted fix/add-to-changelogUse when you've shipped a feature, fix, or breaking change and need to update CHANGELOG.md — follows Keep a Changelog format and syncs version numbers across package manifests./agent-governanceUse when designing or reviewing an AI agent system that needs policy-based access controls, intent classification, tool-level rate limiting, trust scoring for multi-agent workflows, or append-only audit trails.
Other plugins' skills for the same job