← Back to Pull requests

ci: gate releases on license, CodeQL, malware and secret checks #3962

Closed
unknown closed this pull request without merging on Nov 21, 2026 14:18 UTC
View on GitHub
unknown unknown commented on Nov 21, 2026 11:51 UTC
Author

Summary

Release CI now runs vulnerability, malware and secret checks on every platform of every release image, and dependency-license and CodeQL checks on the tagged commit. Promotion fails closed on all of them.

Motivation / Context

Consumers should be able to trust that each released artifact passed the same five checks (license, CVE, malware, secret, SAST) on the exact bytes that ship. Before this change the tag ran only Grype on images and ClamAV on binaries. The license allowlist and CodeQL ran only on PRs and main pushes, so a bot-merged commit or a patch tag could ship unchecked. This PR makes every check run and gate on the tag. Signing the results is the next step (#3957).

Fixes: #3950
Fixes: #3951
Fixes: #3952
Fixes: #3953
Fixes: #3955
Fixes: #3956
Related: #3958

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

  • New feature (non-breaking change that adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

  • Documentation update

  • Refactoring (no functional changes)

  • Build/CI/tooling
  • Component(s) Affected

  • CLI (cmd/aicr, pkg/cli)

  • API server (cmd/aicrd, pkg/server)

  • Recipe engine / data (pkg/recipe)

  • Bundler and deployers (pkg/bundler, pkg/component)

  • Collectors / snapshotter (pkg/collector, pkg/snapshotter)

  • Validator (pkg/validator)

  • Core libraries (pkg/errors, pkg/k8s)

  • Docs/examples (docs/, examples/)

  • Other: release workflow (.github/), tools/image-unpack, RELEASE.md
  • Implementation Notes

    Image checks. image-vuln-scan and operator-scan are replaced by image-checks (check-images.yaml, seven images by candidate digest) and operator-checks (check-operator.yaml, operator and registry from the candidate's local layouts, before anything is pushed). Both run .github/actions/image-checks for each image and platform:

  • tools/image-unpack (new) verifies the OCI layout against the index digest, checks every blob digest and layer diff_id, and unpacks each layer into its own directory. A file deleted by a later layer is therefore still on disk to scan. It also writes the image config and history, and the printable strings of each executable built from the aicr.run module.

  • Grype reads pushed candidates from the registry by digest, as the weekly scan does, because OpenVEX statements name the image by registry repository. Verified with a test statement: an oci-dir: source does not apply it. Grype must report the platform manifest the unpack verified.

  • ClamAV scans every layer and must read exactly the non-empty files the unpack wrote.

  • Gitleaks scans the layers, the config and the strings files with .gitleaks.toml. It fails on any file it reports it could not read.

  • Each run writes a checks.json summary (scanner and database versions, policy file digests, scope, result) to a per-attempt artifact. Nothing is signed yet.
  • Secret scan scope. The Gitleaks default path allowlist stays on, so Python library directories, virtualenvs, node_modules and vendored modules are not scanned. With it off, aiperf-bench produces 152 findings, all upstream test keys and model code inside third-party packages. Binaries not built from AICR are malware-scanned but not secret-scanned. Strings of AICR executables are packed literals, so rules that need a word boundary can miss a token next to another literal. RELEASE.md and the summary state this scope. .gitleaks.toml has one allowlist: the generic keyword rule is off for strings files, where packed literals make it fire at random. Every provider-specific rule still runs on them.

    Source checks on the tag. license-check runs make license-check. codeql analyzes the tag commit and waits for this upload's SARIF processing to complete; the pinned analyze action can give up waiting and still succeed. It then blocks on open CodeQL alerts of High or Critical security severity on the tag ref. Reading alert state rather than the SARIF means dismissed alerts do not block.

    malware-scan fails closed. It now fails on a missing summary, a scan of no files, a count other than expected_files, or a file past a size or nesting limit (--alert-exceeds-max). It installs the pinned ClamAV .deb; it previously used apt with no version.

    Pins. Grype (checksum), Gitleaks and ClamAV are pinned in .settings.yaml, with tools/update--checksums refreshers, Renovate postUpgradeTasks, and check-settings-checksums coverage. The weekly image scan and the repository scan now pass grype-version, so every Grype run uses the pin.

    Release time. Image checks sit before attest. aiperf-bench is the long leg: about 600 MB pulled, about 1.7 GiB unpacked, and a ClamAV pass that took about 5 minutes locally. Expect the release to take several minutes longer than with the Grype-only scan. The first RC will measure it.

    Testing

    make qualify                                   # pass
    make check-settings-checksums                  # all 10 pins match upstream
    go test -race ./tools/image-unpack/ ./tests/releasepolicy/ ./pkg/defaults/
    golangci-lint run -c .golangci.yaml ./tools/image-unpack/... ./tests/releasepolicy/... ./pkg/defaults/...   # 0 issues
    actionlint / yamllint on the changed workflows and actions                                                 # clean
    

  • tools/image-unpack: new package, 85.4% coverage. Tests cover digest, size, diff_id, media-type, platform and path-traversal rejections, per-layer retention of deleted files, duplicate entries, record padding, AICR-executable detection and strings output, and cancellation.

  • tests/releasepolicy: the step scripts run against stub clamscan, grype, gitleaks and gh. They cover each fail-closed branch: no summary, no files, a count mismatch, a limit hit, a findings exit, a Gitleaks read warning, a different manifest, and CodeQL processing pending, failed or errored. Also covered: input validation, artifact names across attempts, and job wiring. Key guards were mutation-checked; the tests fail when each guard is removed.

  • Run against the current release images (pulled by digest), with the pinned tool versions:

  • - Gitleaks: no findings on all seven images; planted tokens are detected.
    - ClamAV: no findings. On aiperf-bench it read exactly the 36,143 non-empty files the unpack wrote. EICAR and an over-limit file both fail.
    - Grype: a test OpenVEX statement applies on the registry source.
    - The merge gate's repository malware scan passes with the new flags.
  • Pre-release probe (temporary workflow, reverted in 204801c91): check-images.yaml ran on a branch push against the v1.3.0 images, and all 14 image/platform checks passed (aiperf-bench 6.5–8.5 min per platform, others 2–3 min). The tag's CodeQL job, uploaded under its own category on a branch ref, produced 14 High/Critical results, all mapped to alerts already dismissed on main, and the gate passed. The probe's code-scanning analyses were deleted. Only an RC proves the tag ref itself, the on-tag.yaml wiring and total release time.
  • Risk Assessment

  • Low — Isolated change, well-tested, easy to revert

  • Medium — Touches multiple components or has broader impact

  • High — Breaking change, affects critical paths, or complex rollout
  • Rollout notes: The release path gains four blocking checks: license on the tag, CodeQL, malware layers and secrets. Land early in a cycle and cut an RC right after, so a false positive shows up on an RC rather than on the release. If the RC is blocked, the job log and the image-checks- artifacts name the cause. Revert is a single PR.

    Checklist

  • Tests pass locally (make test with -race)

  • Linter passes (make lint)

  • I did not skip/disable tests to make CI green

  • I added/updated tests for new functionality

  • I updated docs if user-facing behavior changed

  • Changes follow existing patterns in the codebase

  • Commits are signed off and cryptographically signed (git commit -s -S) — GPG signing info
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: lalitadithya Review duration: 146m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.75) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    57%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #3962"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 58.0% · Lower = rushed or shallow review
    58.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 31.6% · Safe to merge
    31.6%
    Repository