ModelOps Image Vulnerability Remediation: Copacetic Patching and a Registry Promotion Pipeline
A Kubeflow-based ModelOps platform operates more than controller images. Its inventory includes Katib suggestions, Pipeline support services, model serving servers, Trainer Runtimes and notebook images. When an OS package vulnerability appears after a component-version combination has been validated, the platform must decide whether to upgrade the stack or isolate the security change.
The underlying problem is that upstream application releases and distribution security packages do not arrive on the same schedule. A fixed package may already exist in a distribution repository without a rebuilt image for the application release currently in use. Conversely, if upstream already provides a corrected image, the reason to maintain a local patch becomes weaker. Check for a corrected upstream artifact first and reserve direct patching for OS package problems that cannot wait.
The central rule is to give patch creation, security verification, Registry transfer and deployment approval different completion conditions. A single batch invocation can connect them without collapsing their boundaries.
The boundary between batch execution and Air-gap deployment
Section titled “The boundary between batch execution and Air-gap deployment”Assume the patch Runner has the required access, authentication and certificate trust for source Registries, Copacetic tooling image Registries, OS package repositories, the Trivy vulnerability DB and destination Registries. The procedure does not include a person switching network connectivity halfway through a job. Disabling certificate verification is not a substitute for these prerequisites.
Air-gap is the boundary that deployment targets consume only approved internal mirrors. It does not necessarily mean the patch Runner is entirely disconnected. If the Runner is also disconnected, internal supply paths must be prepared for tooling images, package repositories and scanner databases as well as workload images. That is a prerequisite for this batch design, not something Copacetic automatically provides.
Keep the original inventory described in ModelOps GitOps Architecture as the mirror and patch input, separate from approved deployment references. Reassess whenever upstream releases change. Do not assume a patch layer produced for one source remains valid for a different source image.
Choosing an upgrade, rebuild or direct patch
Section titled “Choosing an upgrade, rebuild or direct patch”Choose the remediation by change scope and ownership rather than tool name.
| Choice | Suitable condition | Additional verification |
|---|---|---|
| Update the upstream image | A corrected release exists and platform compatibility can be validated | Component APIs, configuration, data migrations and Runtime changes |
| Rebuild from source | The team owns the source, Dockerfile and dependencies, or application dependencies need updates | Build provenance, dependency locks and functional tests |
| Patch directly with Copacetic | Supported OS packages have fixed versions available and a full rebuild cannot wait | Package change scope, post-patch report and Runtime compatibility |
| Approve an exception or stop using the image | No fix exists or the issue is outside the patch scope | Impact analysis, mitigation, accountable owner, expiration or replacement image |
Copacetic uses BuildKit to apply package updates and produce a new image Artifact rather than rebuilding the entire application from source. It does not modify the upstream original. It produces a separate result with a new tag and digest.
Preserving the application version means not upgrading the application release. It does not guarantee identical behavior after OS libraries change. TLS behavior, native extensions, dynamic linking and process startup can be affected, so security scanning and functional validation remain separate.
The macOS host and Docker Desktop VM architecture
Section titled “The macOS host and Docker Desktop VM architecture”This Architecture shows the patch execution environment. It separates CLIs running on the macOS host from containers inside the Docker Desktop Linux VM, with the source Registry and OS package repositories outside those boundaries. It covers source acquisition, patch generation and scanning; quarantine and approved Registries and GitOps deployment are separate downstream stages.
Interactive DiagramNodes and connections use English labels. Archify’s fixed Viewer UI and HTML language declaration also use English. The dashed Trivy connection is an image-scanning access request, not an approval gate. Arrows from the source Registry and package repositories indicate supplied data; the CLI-to-BuildKit arrow indicates job instructions.
- macOS host:
skopeo,Trivyand the Homebrewcopa CLIbinary run here, calling the Registry and BuildKit inside the VM. - Docker Desktop Linux VM:
copa-localregis an image store based onregistry:2;copa-buildkitdis the patch executor based onmoby/buildkit. Originals and patches occupy distinct tags and digests within the same Registry. - Source copying and scanning: skopeo retrieves the external original and copies it to the local Registry. Trivy reads the original and patched manifests and layers, performs scanning on macOS and saves reports there.
- Patch execution: copa CLI instructs BuildKit through
docker-container://copa-buildkitd. BuildKit reads the local original, obtains OS packages throughapkorapt, and exports and pushes the patched image into the local Registry. OS package updates execute in the VM’s BuildKit, not in the macOS CLI.
The diagram’s :5001 → :5000 distinguishes the host-side access port from the Registry container port. network host describes the BuildKit container’s configuration, not an assertion that macOS and the Linux VM share one network namespace. Actual localhost connectivity depends on Docker Desktop’s host-networking support, configuration and port exposure.
The purpose of the local Registry is not to require separate manual patch and Push operations. It lets scanners and BuildKit reuse a source mirrored once, then lets BuildKit export the patch directly into a Registry for inspection. It also reduces repeated downloads of large ML Runtime images from remote Registries.
The reference implementation stops after recording a TSV mapping between the patched image and its destination Registry reference. Quarantine Push for verified candidates, approved Registry promotion and GitOps reference updates remain separate downstream completion conditions. Keeping them outside this diagram avoids confusing deployment progression with patch-tool execution locations.
Fix source identity and platform first
Section titled “Fix source identity and platform first”A tag is a name used to find an input; a digest identifies the Artifact resolved at that point in time. Recording component:version alone does not fix the source bytes. Record the resolved digest, OS and architecture, and actual mirror result together.
This excerpt illustrates a generalized single-platform mirror. nginx:1.27.5 is an explanatory image reference, not evidence that this version has a particular vulnerability or that a patch succeeded.
SOURCE_REF="docker.io/library/nginx:1.27.5"LOCAL_ORIGINAL="localhost:5001/docker.io/library/nginx:1.27.5"PLATFORM="linux/amd64"
skopeo copy --override-os linux --override-arch amd64 \ --multi-arch system \ "docker://${SOURCE_REF}" "docker://${LOCAL_ORIGINAL}" \ --dest-tls-verify=falseMirroring only linux/amd64 is different from preserving the entire source multi-platform index. Distinguish the index digest from the selected platform manifest digest. For deployments using several architectures, design per-platform patching and verification and the final index construction separately.
The reference script assumes tag inputs and skips digest references, but that is a limitation of its input handling. The Copacetic v0.14 Quick Start also documents digest inputs. Design the input parser so a Registry port’s : is not confused with an image tag’s : by a simplistic string split.
Separate the pre-scan from the Copacetic patch scope
Section titled “Separate the pre-scan from the Copacetic patch scope”A patch-input report focuses on OS vulnerabilities for which fixed packages are available.
trivy image --timeout 10m --platform linux/amd64 \ --image-src remote --insecure \ --scanners vuln --pkg-types os --ignore-unfixed \ --format json --output before.json "${LOCAL_ORIGINAL}"--ignore-unfixed hides findings without a fixed version. That can help select actionable patch inputs, but it does not produce a complete report of residual risk.
Copacetic’s patch mode depends on whether a report is supplied. The reference implementation saves a pre-scan report but does not pass it to copa patch. According to the v0.14 documentation, this performs comprehensive patching, updating outdated OS packages broadly.
PATCH_TAG="1.27.5-patch.1"BUILDKIT_ADDR="docker-container://copa-buildkitd"
copa patch --image "${LOCAL_ORIGINAL}" --tag "${PATCH_TAG}" \ --platform linux/amd64 --addr "${BUILDKIT_ADDR}" \ --push --progress plain --timeout 10mTo select known vulnerable packages based on the report, explicitly supply it. The next excerpt illustrates an alternative mode, not another step to execute immediately after the previous command.
copa patch --image "${LOCAL_ORIGINAL}" --report before.json \ --tag "${PATCH_TAG}" --platform linux/amd64 \ --addr "${BUILDKIT_ADDR}" --push --progress plain --timeout 10mReport-driven patching can also change related packages through dependency resolution. Do not describe it as changing exactly one CVE string or always updating exactly one package. Record the mode, input report and original digest together.
The excerpt’s options have distinct roles:
--pushexports the result directly to a Registry through BuildKit instead of loading it into the local Docker image store.--progress plainkeeps batch logs in plain text. It was also chosen to avoid TTY-related issues in the reference environment.--platformlimits the patched platform.--addrselects the BuildKit endpoint.--timeoutsets a deadline for patching. Mirroring, scanning and Push need their own timeout and retry policies.
Comprehensive patching can run without a report even if the pre-scan fails. However, record the loss of the original report separately from patch success. Silently falling back to comprehensive mode when a targeted patch’s required report is missing changes the scope of the operation and requires an explicit policy.
The Sequence below shows who calls whom during mirroring, pre-scanning, OS patching and rescanning on the normal path. It combines the Architecture’s separate skopeo, Trivy and copa nodes into one macOS CLI lifeline, identifying the executing tool in each call label.
Interactive DiagramRegistry responses to Trivy contain image manifests and layers. Findings and before.json and after.json are produced by the CLI scanning that data; the Registry does not return scan verdicts on its behalf. BuildKit’s patch-generation completion still requires a separate rescan and policy decision. This Sequence does not include promotion, deployment or failure branches, and successful returns are not security approval.
Operating conditions for BuildKit and local HTTP
Section titled “Operating conditions for BuildKit and local HTTP”The reference structure uses a local HTTP Registry and host-network BuildKit. Bind the Registry to the Runner’s loopback interface and confirm that BuildKit resolves the address to the intended endpoint in each environment. Linux host networking and Docker Desktop’s host-network support and configuration do not share identical prerequisites. The presence of --network host does not establish an identical localhost boundary on every platform.
An example BuildKit configuration for the local Registry is:
[registry."localhost:5001"] http = true insecure = trueThis configuration, --dest-tls-verify=false in the mirror excerpt, and Trivy’s --insecure are choices limited to the local HTTP endpoint. They do not justify disabling certificate verification for remote Registries or OS package repositories. Explicitly bind the Registry port to loopback, for example 127.0.0.1:5001:5000, instead of exposing an unauthenticated HTTP Registry externally.
Starting BuildKit as a privileged container belongs on an isolated, trusted Runner. Do not assume that accepting arbitrary jobs on a shared Runner is safe. Record a validated version or digest rather than depending on a mutable tag such as moby/buildkit:latest, and limit Runner lifetime and credential access.
Infrastructure readiness means the Registry and BuildKit actually respond, not that a fixed sleep has elapsed. Do not delete the Registry holding patches whose Push has not been confirmed. Cleanup follows Artifact delivery and retention policy, not simply process termination.
Turn the rescan into an acceptance gate rather than a warning
Section titled “Turn the rescan into an acceptance gate rather than a warning”Separate the post-patch report from patch-input filtering. Even when measuring OS patch effectiveness, do not hide unfixed residual findings. Decide separately whether acceptance of the complete deployment requires scanning application dependencies as well.
LOCAL_PATCHED="localhost:5001/docker.io/library/nginx:${PATCH_TAG}"
trivy image --timeout 10m --platform linux/amd64 \ --image-src remote --insecure --scanners vuln \ --pkg-types os --format json --output after.json "${LOCAL_PATCHED}"Scanner process success, valid JSON and policy acceptance are different checks. The Trivy Exit Code documentation explains that finding vulnerabilities does not change the default exit code from 0. Catching scanner execution failures alone does not create a vulnerability gate. Use --exit-code, severity policy and EOL evaluation when appropriate, or submit a valid report to a policy evaluator.
Even a gate targeting selected CVEs should read VulnerabilityID and package-level findings from the JSON. The number of lines matched by grep is neither the finding count nor the unique CVE count. Never interpret empty output caused by scanner failure as zero findings. Insufficient detection in an EOL image must not be treated as acceptance either.
| State | Meaning | Next action |
|---|---|---|
| scan-error | Scanner execution failed, a report is missing or damaged, or support coverage cannot be established | Stop approval and rescan after resolving the error |
| policy-denied | The scan succeeded but CVE, severity, EOL or other policy requirements were not met | Stop promotion and remediate or review an exception |
| exception-pending | Evidence approving residual risk is not yet available | Hold until the owner, expiration and mitigations are recorded |
| verified | A valid report satisfies the defined policy | Proceed as a candidate for quarantine transfer |
The reference implementation warns when a target CVE remains but still records a pending-Push mapping. Its patched result therefore means patch Artifact creation, not the verified state above. Separate these meanings before attaching automatic Push.
A selected CVE disappearing also does not mean every vulnerability has disappeared. Distinguish zero findings after --ignore-unfixed, zero findings because OS packages were not recognized, and a valid, correctly recognized report that actually passes policy.
Policy-decision specification: unexecuted design
Section titled “Policy-decision specification: unexecuted design”This is a policy specification that has not been implemented or executed. It does not mean an evaluator has been added to the reference script. Inputs are the patched-image report and its evidence reference, scanned manifest digest and platform, OS/package detection coverage, scanner and DB timestamps, and policy_version. The policy version must identify the applicable CVE, severity and EOL rules, required scan coverage and DB validity criteria. This article defines neither a production policy nor thresholds such as allowed finding counts or maximum DB age.
Check input trustworthiness in the following order and record reasons separately from status. Here, scan-error includes not only scanner process errors but also failures to establish the evidence needed for a decision. This is a fail-closed specification: a later successful check cannot overwrite an earlier failure.
| Decision condition | State / reason | Approval-path action |
|---|---|---|
| Scanner failed or report is missing | scan-error / scan-failed or report-missing | Stop until rescanning |
| JSON parsing failed or required structures and fields for that scanner version are invalid | scan-error / report-invalid | Recover the report and reevaluate |
| Digest or platform in scan evidence differs from the candidate, or their relationship cannot be established | scan-error / identity-mismatch | Reconnect candidate and report; do not confuse index and platform manifests |
| Required OS/package inventory detection failed or scan coverage cannot be established | scan-error / coverage-unproven | Do not accept zero findings; resolve support and scan prerequisites |
| DB timestamp or applicable policy version and validity criteria cannot be established | scan-error / decision-input-missing | Stop until inputs are available |
| The identified DB falls outside that policy’s validity criteria | policy-denied / db-stale | Update the DB, rescan and reevaluate |
| EOL evaluation violates the applicable policy, or residual CVE, severity or other rules are unmet | policy-denied / eol-denied or findings-denied | Remediate or hold for a permitted exception review |
| All preceding input checks hold and every condition in the applicable policy is satisfied | verified / policy-satisfied | Security decision only; not promotion or Runtime success |
If evidence is insufficient to determine EOL status, stop with coverage-unproven; evaluate a confirmed EOL status against the specified policy. Hold exception requests as exception-pending, requiring approval evidence linked to policy_version, the target digest, platform and residual findings, plus owner, mitigation and expires_at. Recording an owner, mitigation and expiration alone is not approval. Reevaluate after checking separate approval permitted by the policy and its expiration; do not waive missing reports, identity mismatches or indeterminate coverage through an exception.
Preserve failed stages and retry inputs
Section titled “Preserve failed stages and retry inputs”Process images individually without allowing one failure to erase reports and transfer records for others. The overall exit state should indicate whether any image failed and preserve enough evidence to choose a resume point. set -euo pipefail does not create this state model, particularly when a caller absorbs failures. Each stage needs an explicit result.
When a failure list becomes the next run’s input, truncating that same file at startup destroys the retry targets. Snapshot input before recording new results, and use a separate output path for the new run. Preserve previously successful pending-copy mappings as well. A per-run_id directory with image-level state makes these collisions easier to avoid.
The following is an example record structure, not actual execution output. Digest and timestamp placeholders must be populated from values obtained during execution.
run_id: <run-id>source_ref: docker.io/library/nginx:1.27.5source_index_digest: <source-index-digest-if-present>source_manifest_digest: <selected-platform-manifest-digest>platform: linux/amd64patch_mode: comprehensivepatch_revision: 1local_patch_ref: localhost:5001/docker.io/library/nginx:1.27.5-patch.1patched_digest: <patched-manifest-digest>reports: before: reports/before.json after: reports/after.jsonscanner: version: <trivy-version> db_updated_at: <scanner-db-timestamp>patcher: version: <copa-version> buildkit_digest: <buildkit-image-digest>policy_version: <policy-version>policy_decision: status: pending reason_codes: [] evidence_ref: nullexception: status: pending approval_evidence_ref: null owner: null mitigation: null expires_at: nullverification: <pending-or-verified-or-denied>transfer: <pending-or-copied-or-failed>approval: <pending-or-approved-or-denied>runtime_check: status: pending deployment_record_ref: null evidence_ref: nullrollback_target_digest: nullpolicy_decision, exception, runtime_check and rollback_target_digest are record extensions proposed in this article, not existing output fields of the reference implementation. pending, an empty list and null are placeholders for decisions, approvals and evidence not yet available. verification summarizes the linked policy decision and must not contradict policy_decision.status. An actual record must also distinguish an exception that is unnecessary from one not yet approved.
Choose retry boundaries by stage.
- If mirroring fails, repeat source resolution and copying.
- If patching succeeds but rescanning fails, verify the source and patch digests and rescan the existing patch.
- If only Push fails after verification, confirm policy freshness and Artifact identity, then retry transfer.
- If promotion is rejected, leave the approved Registry and deployment references unchanged.
- If post-deployment Runtime checks fail, perform a separate rollback to the previous approved digest.
Scanner databases and policies change over time. A historical verified state is not permanent approval. Revalidate according to freshness requirements at transfer and promotion time.
Separate quarantine Push from approved Registry promotion
Section titled “Separate quarantine Push from approved Registry promotion”Transfer of a candidate that passed local verification has the following role. Use normal TLS verification and previously provisioned authentication for the remote destination.
QUARANTINE_REF="registry.example.invalid/quarantine/docker.io/library/nginx:${PATCH_TAG}"
skopeo copy "docker://${LOCAL_PATCHED}" "docker://${QUARANTINE_REF}" \ --src-tls-verify=falseskopeo inspect --format '{{.Digest}}' "docker://${QUARANTINE_REF}"After copying, read the exact destination reference to verify the result. Check the relationship between the expected and destination digests too. If manifest-format conversion changes the digest, do not assume equality: record the transformation and mapping, or choose a copy policy that preserves the manifest.
Presence in quarantine is not deployment approval. The promotion gate checks reports, platform, Artifact identity, exceptions and required compatibility evidence before updating the approved Registry. Do not claim that ACR Push automatically blocks vulnerable images in every environment. The actual blocking behavior comes from the wiring between Registry permissions, scanners, policy evaluation and promotion jobs.
Local Trivy and Registry-side scanners can disagree because of DB freshness, distribution interpretation, package inventory and suppression policy. Local acceptance does not guarantee Registry-side acceptance. Begin by checking whether both scanned the same Artifact, then record the report and policy used for the decision.
Changing the digest means a signature or evidence tied to the original digest cannot simply become evidence for the new image. If signing and SBOMs are part of the platform, regenerate or associate them with the patched Artifact. This extends the trust boundary described in SBOM and Image Signing to the new Artifact.
Manage revision tags together with GitOps references
Section titled “Manage revision tags together with GitOps references”Multiple forms of intermediate and final tags make it easy to confuse working candidates with approved outputs. The public example uses <upstream-tag>-patch.N as the revision convention. Repatching the same upstream version creates a new revision such as patch.2; record the date in inventory Metadata.
A revision tag is a naming rule, not an immutability control. Prevent the output tag from equaling the source tag, block overwriting an existing revision and track the approved digest. Avoid an empty suffix default that makes the original mirror and patched output share the same tag.
The GitOps overlay changes only the approved image deployment reference. The following illustrates Kustomize images; the digest placeholder is not usable as an actual execution input.
images: - name: docker.io/library/nginx newName: registry.example.invalid/approved/docker.io/library/nginx digest: sha256:<approved-manifest-digest>The source inventory can retain docker.io/library/nginx:1.27.5 as its input. A separate mapping connects 1.27.5-patch.1, the approved digest and the modified overlay. A deployment tag in an inventory comment is a human-readable aid, not proof that a workload actually references the patched image.
Before deployment, compare image references in the rendered overlay. After deployment, confirm the image identity actually used by Pods and check core functionality. Serving might require model loading and inference, a Trainer might require job start and completion, and notebooks might require kernel startup and key dependency imports. These are examples of required acceptance and operating checks, not tests executed for this article.
Rollback means returning to the previous approved Artifact digest and its GitOps change, not merely the old upstream tag. Preserve previous patches according to rollback windows and audit-retention policy rather than deleting them unconditionally.
The proposed runtime_check.deployment_record_ref points to a separate deployment record linking the patch run_id, approved digest and platform to the deployment’s GitOps revision, overlay and workload. runtime_check.evidence_ref points to evidence of the observed Pod image identity, role-specific checks, results and observation time for that deployment, not results from another deployment using the same image. Before deployment, keep both references null and the status pending. Registry approval or Pod startup alone must not be recorded as completed Runtime verification without linked evidence. rollback_target_digest is also null in the example because the previous approved Artifact has not yet been established. An actual deployment record must confirm that digest’s platform, retention location and GitOps revision to restore. If no previous approved Artifact exists or its retention is uncertain, do not record rollback readiness. This linkage is an unexecuted trace contract, not a claim that deployment or rollback automation has been implemented.
Vulnerabilities an OS patch does not fix
Section titled “Vulnerabilities an OS patch does not fix”Draw the OS-patching boundary between packages managed by the OS package manager and dependencies included separately by the application. Check the supported distributions, package managers and image Metadata for the Copa version in use.
| Finding location | Remediation decision | Caveat |
|---|---|---|
| OS-managed OpenSSL, git and similar packages | Check fixed package availability and Copacetic support | Fixed package versions differ across distributions even for the same library |
Application dependencies such as Python wheels or Julia OpenSSL_jll | Update application dependencies or rebuild from source | Updating OS OpenSSL does not necessarily replace a bundled library |
| Compiled dependencies inside a Go binary and similar artifacts | Rebuild with corrected dependencies or choose a corrected upstream image | OS patching does not modify code compiled into the binary |
| Host Linux kernel | Use the node, VM or host-kernel update path | A different responsibility boundary from container userspace patching |
| EOL OS or inaccessible package repositories | Consider rebuilding on a supported OS or replacing the image | Scanner zero findings must not be interpreted as security approval |
A kernel-related CVE disappearing from an image report does not prove that the host kernel has been updated. Nor should every kernel finding be dismissed as a false positive. Identify the package behind the finding, analyze its relationship to the running host kernel and act within the correct ownership boundary.
Maintain specific CVE lists and fixed versions against the scanner DB and distribution advisories. Do not use one distribution’s OpenSSL version as a universal safety threshold for another, or reuse a historical successful operation as security evidence for the current image.
Summary and connected reading
Section titled “Summary and connected reading”Image patching does not end when the copa command succeeds. Source identity → patch generation → valid report and policy evaluation → confirmed transfer → promotion → GitOps reference → Runtime verification each need their own completion condition. Batch execution reduces manual handoffs; it does not remove approval boundaries.
The benefit is separating application-release changes from OS-package remediation while preserving the relationship between source and deployment Artifacts. The cost is that the platform owns its patch revisions, compatibility checks and reapproval lifecycle. Include a decision to retire the local patch when a corrected upstream image becomes suitable.
- ModelOps GitOps Platform: Series ownership boundaries and reading path
- ModelOps GitOps Architecture: Vendor snapshots, overlays and Air-gap inventory
- Container Image Vulnerability Management: Registry detection and querying
- Copacetic v0.14 Quick Start: Comprehensive versus report-driven patching. This explains the reference implementation’s version behavior; check currently supported versions for a new deployment.
- Trivy Filtering: Severity and status filters, including
--ignore-unfixed - Trivy Exit Code and EOL: Exit policy that distinguishes findings from execution status