container-image-patching
Skill0 starsChanged 39 days agoMITView on GitHub
Use when patching a Docker or OCI image, a Trivy finding disappears after rebuilding, or before/after scan results disagree about whether a package was fixed.
- Installs packages
In this repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- postgres-locking-joinsSkill
- ai-bug-patternsSkill
- compressed-ndjson-boundariesSkill
- http-resume-integritySkill
- linux-io-latency-triageSkill
- macos-disk-space-recoverySkill
- minimal-sufficient-evidenceSkill
- modularize-large-filesSkill
- patch-reproducer-validitySkill
- prompt-cache-boundariesSkill
- proton-drive-selective-backupSkill
- transactional-outbox-deliverySkill
- conventional-commitsSkill
- git-advanced-mergingSkill
- git-bisect-forensicsSkill
- git-data-recoverySkill
- git-hooksSkill
- git-rerereSkill
- git-reset-mechanicsSkill
- git-revisions-syntaxSkill
- git-rewriting-historySkill
- git-submodulesSkill
- git-worktreesSkill
- github-ssh-keysSkill
- npm-publish-ci-pitfallsSkill
- sapling-stacked-pr-workflowSkill
- go-concurrency-patternsSkill
- go-data-idiomsSkill
- go-error-handlingSkill
- go-interfaces-embeddingSkill
- go-pprof-profilingSkill
- marketing-funnel-diagnosisSkill
- marketing-geo-experimentsSkill
- marketing-incrementalitySkill
- marketing-positioning-testsSkill
- python-descriptors-mroSkill
- python-logging-cookbookSkill
- python-scaling-regression-testsSkill
- python-unicode-gotchasSkill
- rust-compile-time-invariantsSkill
- rust-deterministic-concurrency-testsSkill
- rust-error-identity-boundariesSkill
- rust-regex-search-contractsSkill
- rust-runtime-bug-classesSkill
- rust-tokio-actor-deliverySkill
- rust-tokio-cancellation-safetySkill
- sales-discovery-qualificationSkill
- sales-mutual-action-plansSkill
- sales-pipeline-forecast-calibrationSkill
- sales-value-negotiationSkill
- ai-triage-evaluationSkill
- dependency-artifact-integritySkill
- dnssec-sentinel-diagnosticsSkill
- iam-policy-change-replaySkill
- rbvm-applicabilitySkill
- rbvm-asset-evidenceSkill
- rbvm-guarded-remediationSkill
- rbvm-priority-decisionsSkill
- rbvm-risk-exceptionsSkill
- The first 60 shown.
The file
Files
Container Image Patching
A disappearing finding is not a demonstrated patch. Compare immutable artifacts under equivalent detection conditions, then prove the installed component changed.
Evidence contract
| Preserve | Why |
| Manifest digests and platform | Tags and other architectures are not the tested artifact |
| Scanner version, database identity/time, effective configuration | Detector changes can create an apparent fix |
| Target/path, package source, installed release, advisory | One CVE can affect multiple independently installed copies |
| Logs, inventory, exclusions and suppressions | Empty findings do not establish complete coverage |
Recipe
- Confirm owner, approved image/build environment, scan/build permissions, and rollback. Use provisioned tooling; missing tools require approval, not automatic installation. Builds execute Dockerfile instructions; image scanning may retrieve images/databases. Publishing or deploying needs separate authority.
- Resolve the source digest and platform; preserve index-to-platform-manifest mapping for multi-platform images. For local builds, retain the immutable local image ID and build provenance until a manifest exists. Record size using the same measurement method before/after.
- Audit configuration, environment, ignore files, VEX and exclusions before collection; JSON still honors filters. Retain these identities and package inventory, then create presentation views. In an approved environment with exported digest reference and platform:
: "${IMAGE_REF:?Set the approved digest reference}"
: "${PLATFORM:?Set the approved OS/architecture}"
trivy image --scanners vuln --pkg-types os,library --list-all-pkgs \
--platform "$PLATFORM" --format json --output before.json \
"$IMAGE_REF" 2>before.log && \
trivy convert --format table --severity HIGH,CRITICAL before.json- Route each component by installation provenance: distro-managed packages use matching vendor releases/backports; language dependencies need their dependency/build workflow. Preserve unfixed findings. HIGH/CRITICAL is a view, not prioritization policy; use RBVM decisions.
- Select reviewed fixed releases. For Debian/Ubuntu,
apt-get install --only-upgradetargets installed packages, but dependency resolution still needs inspection. Simulate in the equivalent build context; reject unapproved removals, downgrades, or collateral changes. Version selection can downgrade. Revalidate before applying; simulation is not a locked transaction. Keep update/install/list-cleanup in one Dockerfile layer; a supported base-image refresh is an alternative requiring its own review. - Scan the candidate with equivalent coverage/configuration and database snapshot; if these changed, rescan both immutable artifacts. Match component instances, not CVE totals. Verify the installed release or verified removal, remaining/new findings, and runtime compatibility tests. Missing/unsupported/EOL coverage or scan failure stays unknown. Route deployment evidence through verified closure.
- Retain the existing ≤20% size-increase ceiling and
-cve-patchednaming unless the owner approves different policy; neither proves safety. Report digests, package changes, evidence differences, residual findings, tests, and limits.
Sources and synthetic counterexamples; documentation reviewed 2026-10-21. Trivy/Docker commands were not runtime-tested.
Pitfalls
- Trivy normally exits zero even with findings; process success is not a clean verdict.
- Severity/unfixed/suppression filters can erase evidence without changing installed bytes.
- Digest pinning prevents silent drift but also requires deliberate security updates.
Does 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.

