Fix Image CVEs
Use scripts/fix_image_cves.py for dependency selection, source updates, and
verification. The helper implements the lowest-fixed-version policy and manages
module, vendor, and license updates; it does not build or push images.
Run from the repository root, replacing <SKILL_DIR> with this skill directory.
When running elsewhere, add --repo <worktree> to each command.
Workflow
Scan the built image, specifying the owning module and runtime Dockerfile, then inspect the plan:
python3 <SKILL_DIR>/scripts/fix_image_cves.py scan <image> \ --module-root <module-dir> --dockerfile <Dockerfile> python3 <SKILL_DIR>/scripts/fix_image_cves.py planReview the plan before changing files and choose any required image targets:
- Select a locally installed Go version satisfying the repository and planned Go directives; do not rely on automatic toolchain downloads.
- For a Go directive bump, update older builders for every affected Dockerfile
to a stable Go version at least as new as the target. Preserve the builder's
registry, repository, and OS variant. Include both
Dockerfile:builderandcloud-node-manager.Dockerfile:builderwhen the root module needs new builders. - For runtime CVEs, select a fixed base image. Verify target-platform support and the actual digest for every image target; these are agent decisions.
Preview and apply. Append one
--base-image-target <Dockerfile>:<stage>=<image>@sha256:<digest>per chosen target to both commands; usebuilderorruntimefor the stage. Omit the option when no image change is needed.python3 <SKILL_DIR>/scripts/fix_image_cves.py apply --dry-run python3 <SKILL_DIR>/scripts/fix_image_cves.py applyVerify the source changes:
python3 <SKILL_DIR>/scripts/fix_image_cves.py verifyRebuild the image outside this helper, then rescan that rebuilt image:
python3 <SKILL_DIR>/scripts/fix_image_cves.py verify \ --rescan --image <rebuilt-image>Record results before starting another scan. Clean up after success or an intentional workflow reset:
python3 <SKILL_DIR>/scripts/fix_image_cves.py clean
Failures and Reporting
- If the helper stops, preserve its evidence and any partial changes, report the cause, and resolve it before retrying. Do not edit saved state to bypass checks.
- Report Go toolchain findings (
stdlib/toolchain) and findings without a fixed version as residual risks; the helper does not auto-fix them. Unsupported fixable findings require manual remediation and must not be reported as clean. - Distinguish file checks from rebuilt-image verification. A rescan verifies the planned CVEs, not that the entire image is free of vulnerabilities.