container-security-audit
Skill2 starsChanged 3 months agoMITView on GitHub
Reusable, language-agnostic Docker/OCI container security audit and remediation skill for local development or CI.
In this repository9 other files it gives its agents.
- animejsSkill
- tiger-styleSkill
- nextjs-security-reviewSkill
- reactflowSkill
- react-security-reviewSkill
- spec-locked-tddSkill
- structural-refactorSkill
- whatsapp-cloud-apiSkill
- whatsapp-flows-jsonSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
50 rules. About 0 are common, 46 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈46
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Do not skip a relevant reference merely because you think you already know the topic.
- Distinctive: line 43
verify application behavior using existing project checks.
- Distinctive: line 44
create a timestamped Markdown audit report in the project.
- Distinctive: line 45
if repository files changed, generate a strict Conventional Commit message.
- Distinctive: line 138
remove required functionality just to reduce counts.
- Distinctive: line 176
Before relying on time-sensitive details, consult current primary documentation.
- Very specific: line 191
If current web access is unavailable, use installed tool --help/version output and clearly document the limitation.
- Distinctive: line 201
Use for fast developer checks:
- Distinctive: line 253
Before editing or building, inspect:
- Distinctive: line 302
If multiple production-relevant images exist, audit each relevant image.
- Very specific: line 304
Never assume Node.js, Python, Go, Rust, Java, PHP, .NET, Ruby, etc.
- Distinctive: line 310
Before running scans, read:
- Distinctive: line 328
If builds occur on production, Docker socket access exists, or builder isolation matters, read:
- Distinctive: line 334
If CI integration or repeatable local automation is requested, read:
- Distinctive: line 348
Do not run every tool simply because it exists.
- Distinctive: line 354
Use the exact commands appropriate to the installed versions.
- Distinctive: line 376
Do not print full discovered secrets into chat, logs, or reports.
- Distinctive: line 378
If a real credential is discovered, remember:
- Distinctive: line 404
Use a clearly temporary/local image tag, for example:
- Distinctive: line 410
If testing whether current base-image updates remediate findings:
- Very specific: line 416
Do not use --no-cache unless there is a reason.
- Very specific: line 418
Never inject real secrets into insecure Docker ARG/ENV merely to make a build succeed.
- Distinctive: line 420
Before building an unfamiliar Dockerfile, inspect:
- Distinctive: line 456
Do NOT use it to claim the image has no remaining risk.
- Distinctive: line 464
Do not commit raw scanner output by default.
- Distinctive: line 508
Never use "ignore" as analysis.
- Distinctive: line 551
Do not call every style issue a vulnerability.
- Distinctive: line 575
If production also builds source, document:
- Distinctive: line 599
update vulnerable direct dependency
- Distinctive: line 600
update vulnerable transitive dependency via supported resolution
- Distinctive: line 602
update to maintained base-image release
- Distinctive: line 603
remove unnecessary vulnerable runtime package
- Distinctive: line 607
document unresolved upstream issues
- Distinctive: line 608
create a time-bounded waiver only when remediation is not currently appropriate
- Distinctive: line 613
add blanket OS upgrades only to manipulate scan counts
- Distinctive: line 641
If base-image freshness is part of the fix:
- Distinctive: line 654
Run existing project checks where available:
- Distinctive: line 665
Do not fabricate successful verification.
- Distinctive: line 667
If something cannot be verified, report that explicitly.
- Distinctive: line 673
Every completed audit MUST create a Markdown report.
- Distinctive: line 688
If no relevant directory exists, create:
- Distinctive: line 710
If something was not checked, write:
- Distinctive: line 722
If a scan failed, document the failure.
- Distinctive: line 728
If repository files changed, generate a commit message strictly following Conventional Commits 1.0.0.
- Distinctive: line 762
Do not run git commit unless explicitly authorized.
- Distinctive: line 789
every suppression has a reason
- Distinctive: line 790
every suppression has a review date
- Distinctive: line 792
never suppress solely to make CI green
- Distinctive: line 795
If using Trivy ignore/VEX features, verify current official syntax first.
- Distinctive: line 843
avoid dumping hundreds of low-value findings.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Container Security Audit
0. Mandatory reading contract
You MUST read this entire SKILL.md before executing an audit or making container-security changes.
Then load the relevant supporting files:
references/tooling.md— tools, installation, commands, scan modesreferences/cve-triage.md— interpreting and prioritizing CVEsreferences/container-hardening.md— Dockerfile/image/runtime hardeningreferences/build-host-security.md— builder/host/Docker-daemon riskreferences/ci-and-automation.md— CI gates and repeatable workflowstemplates/audit-report.md— mandatory report format
Do not skip a relevant reference merely because you think you already know the topic.
This skill is designed for any project that builds Docker/OCI images. It must remain language- and framework-agnostic.
1. Objective
Given a source repository:
- discover container build/deployment structure;
- identify relevant Dockerfiles/images;
- inspect local project configuration;
- scan repository, secrets, misconfigurations, and dependencies;
- build the relevant image(s) when safe and possible;
- scan the built image(s);
- triage serious findings;
- apply safe, source-controlled remediations;
- rebuild;
- rescan;
- verify application behavior using existing project checks;
- create a timestamped Markdown audit report in the project;
- if repository files changed, generate a strict Conventional Commit message.
Expected lifecycle:
discover
↓
inspect
↓
scan source/config
↓
build image
↓
scan image
↓
triage
↓
remediate
↓
rebuild
↓
rescan
↓
verify
↓
report
↓
suggest commit message2. Scope
This skill covers:
- Dockerfiles and OCI-compatible image builds
- base-image review
- OS and application package vulnerabilities
- image vulnerability scanning
- filesystem/repository scanning
- secret detection
- Dockerfile/build misconfiguration checks
- SBOM generation when justified
- CVE triage
- runtime-user and privilege review
- build-host risk review
- local developer workflows
- optional CI integration
- remediation and verification
- timestamped audit reports
- Conventional Commit output when files change
This skill does NOT replace:
- SAST
- DAST
- penetration testing
- runtime IDS/EDR
- Kubernetes cluster security reviews
- host OS hardening
- cloud IAM reviews
- business-logic security reviews
- full threat modeling
A clean container scan does not prove the application is secure.
References
- NIST SP 800-190: https://csrc.nist.gov/pubs/sp/800/190/final
- OWASP Docker Security Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html
3. Operating principles
3.1 Scanner output is evidence, not truth
A scanner match means a component/version appears associated with a known issue.
It does not automatically prove:
- the vulnerable code path is reachable;
- the issue applies to the specific distro build;
- the package is used at runtime;
- exploitation is practical in this deployment.
Investigate serious findings.
3.2 Never optimize for "zero findings"
Do not:
- remove required functionality just to reduce counts;
- suppress findings without justification;
- downgrade software to silence a scanner;
- swap base image families solely because another image has fewer CVEs;
- hide unfixed vulnerabilities and call the image clean.
3.3 Prefer source-controlled remediation
Prefer:
Dockerfile/dependency change
↓
rebuild
↓
rescanover patching a production image in place.
3.4 Preserve behavior
Security changes must not silently break:
- startup
- native dependencies
- filesystem permissions
- TLS certificates
- timezone behavior
- signal handling
- networking
- writable directories
- runtime users
3.5 Keep security data current
Commands, image tags, tool behavior, and CVE state may change.
Before relying on time-sensitive details, consult current primary documentation.
Source priority:
- vendor/project security advisory
- OS/distribution advisory
- tool maintainer docs
- Docker docs
- NIST/CISA/NVD
- FIRST EPSS when useful
- cloud-provider security guidance
- OWASP
- reputable security research
- community material only as supplemental evidence
If current web access is unavailable, use installed tool --help/version output and clearly document the limitation.
4. Audit modes
Default mode: STANDARD
QUICK
Use for fast developer checks:
- project discovery
- Docker build checks if supported
- focused repository scan
- local image build
- HIGH/CRITICAL image scan
- minimal triage
- mandatory report
STANDARD
Use by default:
- full project discovery
- tool/version discovery
- Dockerfile/build checks
- repository vulnerability scan
- secret scan
- misconfiguration scan
- image build
- full image vulnerability scan
- HIGH/CRITICAL actionable view
- base-image review
- runtime-user/privilege review
- build-host risk review
- safe remediation
- rebuild
- rescan
- project verification
- mandatory report
- Conventional Commit suggestion if files changed
DEEP
STANDARD plus, when justified:
- SBOM generation
- second scanner
- detailed dependency-origin analysis
- base-image alternative analysis
- deeper build-host review
- KEV/EPSS prioritization
- waiver review
- CI security-gate recommendations
DEEP means deeper investigation, not more aggressive modification.
5. Phase A — project discovery
Before editing or building, inspect:
Dockerfile
Dockerfile.*
**/Dockerfile
compose.yml
compose.yaml
docker-compose.yml
docker-compose.yaml
.dockerignore
.github/workflows/
.gitlab-ci.yml
Jenkinsfile
Procfile
Makefile
Taskfile*
scripts/
docs/
security/
package manifests
lockfiles
deployment filesAlso read repository-local instructions if present:
AGENTS.md
CONTRIBUTING.md
README.mdDetect:
- container runtime
- Dockerfile path(s)
- build context(s)
- multi-stage vs single-stage
- base image(s)
- package ecosystem(s)
- package manager(s)
- runtime user
- exposed ports
- CI provider
- deployment model
- whether production builds source directly
- whether multiple deployable images exist
If multiple production-relevant images exist, audit each relevant image.
Never assume Node.js, Python, Go, Rust, Java, PHP, .NET, Ruby, etc. until discovered.
6. Phase B — choose tools and read relevant references
Before running scans, read:
references/tooling.mdFor serious CVEs, also read:
references/cve-triage.mdFor Dockerfile/runtime findings, also read:
references/container-hardening.mdIf builds occur on production, Docker socket access exists, or builder isolation matters, read:
references/build-host-security.mdIf CI integration or repeatable local automation is requested, read:
references/ci-and-automation.mdDefault scanner: Trivy
Optional supporting tools:
- Docker Build checks
- Syft
- Grype
Do not run every tool simply because it exists.
7. Phase C — baseline scans
Use the exact commands appropriate to the installed versions.
Typical STANDARD sequence:
docker version
docker buildx version
trivy --versionWhen supported:
docker build --check .Repository scan:
trivy fs --scanners vuln,misconfig,secret .Do not print full discovered secrets into chat, logs, or reports.
If a real credential is discovered, remember:
delete from file
≠
credential fixedPotential remediation:
revoke
↓
rotate
↓
remove from source/build context
↓
consider history cleanup
↓
replace with supported secret mechanism8. Phase D — build audit image
Use a clearly temporary/local image tag, for example:
docker build -t <project>:security-audit .If testing whether current base-image updates remediate findings:
docker build --pull -t <project>:security-audit .Do not use --no-cache unless there is a reason.
Never inject real secrets into insecure Docker ARG/ENV merely to make a build succeed.
Before building an unfamiliar Dockerfile, inspect:
RUNcommands- remote downloads
- build scripts
- unusual mounts
- BuildKit insecure entitlements
- Docker socket exposure
- host path mounts
A Docker build executes build instructions. It is not harmless static analysis.
9. Phase E — scan image
First run the full scan:
trivy image <project>:security-auditThen focused serious findings:
trivy image --severity HIGH,CRITICAL <project>:security-auditOptionally show currently fixable serious findings:
trivy image --severity HIGH,CRITICAL --ignore-unfixed <project>:security-auditInterpret --ignore-unfixed only as an actionable view.
Do NOT use it to claim the image has no remaining risk.
For machine-readable investigation when necessary:
trivy image --format json --output <temporary-path>/trivy-image.json <image>Do not commit raw scanner output by default.
10. Phase F — triage
For meaningful HIGH/CRITICAL findings, read:
references/cve-triage.mdCollect, where available:
CVE/advisory ID
package
installed version
fixed version
severity
severity source
OS vs application dependency
direct vs transitive
build-time vs runtime
fix available?
vendor/distribution status
KEV status if checked
EPSS context if useful
likely reachable/exposed?
recommended remediation
confidenceDisposition must be one of:
ACTION NOW
ACTION WHEN FIX AVAILABLE
ACCEPT TEMPORARILY WITH JUSTIFICATION
NOT APPLICABLE WITH EVIDENCE
FALSE POSITIVE WITH EVIDENCE
NEEDS MANUAL REVIEWNever use "ignore" as analysis.
11. Phase G — hardening review
Read:
references/container-hardening.mdReview:
- base-image maintenance/support status
- tag/digest strategy
- multi-stage build opportunities
- unnecessary runtime packages
- root vs non-root runtime
.dockerignore- overly broad
COPY - secret handling
- package-manager residue
- remote download integrity
- entrypoint/CMD behavior
- health check relevance
- privileged mode
- Linux capabilities
- host mounts
- Docker socket mounts
- writable root filesystem
- EOL distro/runtime
Classify each finding as:
SECURITY ISSUE
HARDENING OPPORTUNITY
RELIABILITY ISSUE
MAINTAINABILITY ISSUE
INFORMATIONALDo not call every style issue a vulnerability.
12. Phase H — build-host review
If relevant, read:
references/build-host-security.mdExplicitly distinguish:
image securityfrom:
machine that builds/runs the imageIf production also builds source, document:
build/runtime isolation: shared hostDo not automatically:
- migrate production to rootless Docker
- reconfigure daemon settings
- change firewall rules
- change kernel security settings
- stop Docker
- restructure CI
- alter Dokku/Dokploy internals
Host hardening requires its own explicit workflow/approval.
13. Phase I — remediation hierarchy
Prefer, where applicable:
- update vulnerable direct dependency
- update vulnerable transitive dependency via supported resolution
- refresh base image
- update to maintained base-image release
- remove unnecessary vulnerable runtime package
- move build-only packages into builder stage
- harden Dockerfile safely
- change base-image family only when justified and tested
- document unresolved upstream issues
- create a time-bounded waiver only when remediation is not currently appropriate
Do not:
- mass-upgrade unrelated packages without reason
- add blanket OS upgrades only to manipulate scan counts
- switch to Alpine/distroless solely for lower CVE counts
- break compatibility to make the scanner green
14. Phase J — rebuild, rescan, verify
A remediation is incomplete until verified.
Mandatory loop:
baseline
↓
change
↓
rebuild
↓
rescan
↓
test
↓
compareRebuild the relevant image.
If base-image freshness is part of the fix:
docker build --pull -t <project>:security-audit .Rescan:
trivy image <project>:security-audit
trivy image --severity HIGH,CRITICAL <project>:security-auditRun existing project checks where available:
- unit tests
- integration tests
- typecheck
- lint
- smoke test
- container startup
- health endpoint
- application-specific validation
Do not fabricate successful verification.
If something cannot be verified, report that explicitly.
15. Mandatory audit report
Every completed audit MUST create a Markdown report.
Read and use:
templates/audit-report.mdPreferred location order:
existing project security/docs convention
→ docs/security/audits/If no relevant directory exists, create:
docs/security/audits/Filename:
container-security-audit-YYYYMMDD-HHmmssZ.mdUse UTC.
Example:
docs/security/audits/container-security-audit-20260930-112300Z.mdReports must never contain raw secrets.
If something was not checked, write:
Not checkednot:
No issueIf a scan failed, document the failure.
16. Conventional Commit requirement
If repository files changed, generate a commit message strictly following Conventional Commits 1.0.0.
Default security-fix form:
fix(security): remediate container audit findingsPrefer precision:
fix(security): update runtime base image and drop root userDependency-only remediation:
fix(deps): update vulnerable runtime dependenciesReport-only change:
docs(security): add container security audit reportBreaking changes:
fix(security)!: harden container runtime contract
BREAKING CHANGE: <explanation>Do not run git commit unless explicitly authorized.
Reference
- Conventional Commits 1.0.0: https://www.conventionalcommits.org/en/v1.0.0/
17. Waiver rules
Suppressions require evidence.
A waiver should include:
id: CVE-YYYY-NNNN
package: example
status: accepted-temporarily
reason: "..."
evidence: "..."
reviewed_at: YYYY-MM-DD
expires_at: YYYY-MM-DD
owner: project-teamRules:
- every suppression has a reason
- every suppression has a review date
- temporary suppressions have an expiry
- never suppress solely to make CI green
- reevaluate when vendor/scanner data changes
If using Trivy ignore/VEX features, verify current official syntax first.
18. CI and local automation
CI is optional.
The audit must work locally without:
- GCR
- ECR
- GHCR
- Docker Hub push
- paid security SaaS
- paid runners
A valid CI flow is:
checkout
↓
build temporary image
↓
scan
↓
pass/fail
↓
discard imageNo registry required.
For implementation guidance, read:
references/ci-and-automation.md19. User-visible execution behavior
During an audit:
- state which Dockerfiles/images were discovered;
- surface serious confirmed issues early;
- explain why each remediation is being applied;
- avoid dumping hundreds of low-value findings;
- report before/after counts;
- identify changed files;
- give the audit report path;
- give the Conventional Commit message if files changed.
20. Default STANDARD checklist
Discovery
- read this full
SKILL.md - read repository-local instructions
- inspect git status
- do not overwrite unrelated changes
- locate all Dockerfiles
- locate Compose/deployment files
- locate
.dockerignore - detect package ecosystems/lockfiles
- detect CI/deployment model
- identify production-relevant images
- identify whether production builds source
Tools
- read
references/tooling.md - record Docker version
- record Buildx version
- record Trivy version
- record Syft/Grype only if used
- verify current docs for version-sensitive behavior
Baseline
- run Docker build checks where supported
- run repository vuln/misconfig/secret scan
- build local audit image
- run full image scan
- run HIGH/CRITICAL view
Analysis
- triage serious CVEs
- read
references/cve-triage.md - review Dockerfile/runtime hardening
- read
references/container-hardening.md - review build-host isolation where relevant
- read
references/build-host-security.md
Remediation
- apply only justified changes
- preserve application behavior
- avoid unrelated cleanup
- document waivers when needed
Verification
- rebuild
- rescan
- run existing project verification
- compare before/after
Reporting
- read
templates/audit-report.md - create timestamped report
- redact all secrets
- include actual sources used
- generate strict Conventional Commit if files changed
- do not auto-commit unless authorized
21. Definition of done
An audit is complete only when:
- relevant build surfaces were discovered
- tools/versions were recorded
- repository/configuration checks were run where possible
- relevant images were built or inability was documented
- relevant images were scanned
- serious findings were triaged
- safe remediation was applied where justified
- remediated images were rebuilt
- remediated images were rescanned
- available tests/checks were run
- unresolved risk was documented
- no secrets were leaked into reports
- timestamped audit report was created
- report includes actual sources consulted
- Conventional Commit was generated if repository files changed
- no automatic commit occurred without authorization
22. Final rule
Do not confuse:
scanner cleanwith:
secureThe objective is:
know what is present
+
know what is vulnerable
+
understand what is relevant
+
fix what can safely be fixed
+
document what remains
+
make the process reproducibleDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

