Skip to content

release publish: scan every artifact before the stage, with a pinned scanner, under supply-chain #5446

Closed

Description

@lex00

Every release should be scanned for vulnerabilities before anything reaches a registry, under the supply-chain group, in the pipeline chant release workflow renders, with nothing for a team to wire by hand. This applies to any chant project's release, not only the CI products.

What exists, checked at chant 3bf0df0

  • vuln-gate (components/verbs/vuln-gate.ts, scanners in vuln-scan.ts) scans an SBOM with grype or trivy, applies VEX, and can fail on KEV and EPSS. It runs as a component step only.
  • chant release publish stages every target, runs release.verify, and then reveals (publishing: resume after a failure without republishing, and all-or-nothing visibility #4048, release: pre-reveal verify step #5157). The stage, verify and reveal live in lifecycle/publish-*.ts, and nothing there scans.
  • The stage is not private. For an oci target it pushes the layers and manifest by digest to the consumer's registry, and signing pushes the cosign and SLSA referrers during the stage (publish-oci.ts header, publish-signing.ts). Only tags wait for the reveal. A check after the stage leaves a signed image in the registry, pullable by digest, and there is no unstage.
  • An oci target takes any archive (publish-declaration.ts), not only one release.images built.
  • Image builds run with --sbom=false (release-images.ts, releaseImageBuildCommand). The SBOM a release attaches is written from the lockfile (publish-attachments.ts), so an image's SBOM lists no OS packages. A syft image backend exists (tool-sbom-generator.ts).
  • TOOL_PINS (tool-pins.ts) holds cosign, goreleaser and nfpm, which the rendered pipeline installs by checksum. It holds no scanner.
  • A team can call a scanner from release.verify with $CHANT_STAGED_IMAGES, but that runs after the stage, every project writes it by hand, and the result goes into no record.

What it should be

  • release.scan, on by default under supply-chain, runs before the stage and before signing.
  • For each oci target, and each helm target's oci, it scans the local OCI archive, which chant release images has already digest-checked. The scan uses an SBOM made from the image layers with the syft backend, not the lockfile SBOM.
  • That layer SBOM becomes the SBOM the image is published with, as its referrer, in place of the lockfile one.
  • Every other SBOM the publish attaches (npm packages, forge assets, goreleaser and nfpm artifacts) is scanned by the same gate.
  • The gate is the same one components use: failOn severity, failOnKev, EPSS thresholds and a VEX file. A failure stops the publish with publish-scan-failed before anything is pushed.
  • The findings and the scanner's database version are appended to _releases/publishes.jsonl, and attached as a referrer beside the SBOM, so a reader of the release can see what was known when it shipped.
  • The scanner and syft get TOOL_PINS rows. A release-steps feature installs them in the rendered pipeline when supply-chain is on and the release has anything to scan, the way cosignSetup installs cosign, on GitHub, GitLab and Forgejo.
  • chant release doctor reports a missing scanner on a workstation before a cut.
  • The scanner's database download needs network. network-egress.mdx gets a row, and an offline database path is allowed.

This is the scan FedRAMP's container guidance asks of images before they reach a registry consumers pull from (RA-5), and it matters more once images can change base (#5445). Other scanners plug in through the gate's scanner interface; the Wiz adapter (wizcli docker scan) is built in #5451, and this issue ships grype or trivy.

Today nothing in release-init.ts sets a security group, so a new release starts with none of this; see the decision below.

Done when

  • A release with an image that has a known critical CVE stops at the scan, and nothing is pushed: no layers, manifest or referrer.
  • The same holds for an npm package with a critical CVE in its lockfile.
  • The rendered pipeline on all three forges installs the pinned scanner with no release.workflow entry.
  • The published image's SBOM lists its OS packages.
  • The record and the referrer hold the findings.
  • SECURITY_FEATURES (workspace/security.ts) has a row, which the security features reference is tested against.
  • The same holds for a train's release workflow (release-train-workflow.ts, chant workspace train publish), which behold releases with. Today it receives only releaseSetupSteps and the idTokens slot (release-workflow.ts, the train context), so job steps added here must reach it too.
  • The tests use fakes: a local registry fake and a scanner fixture DB. Nothing reaches a real registry.

Pull requests, in order

  • 1. The gate before the stage: scan the local OCI archive and every attached SBOM, publish-scan-failed, TOOL_PINS rows and the install step on github, gitlab and forgejo, and the train.
  • 2. The layer SBOM from syft replaces the lockfile SBOM as the image's SBOM referrer.
  • 3. The record in _releases/publishes.jsonl, the findings referrer, release doctor, SECURITY_FEATURES and the docs.
  • Decision, recorded here before 1 merges: whether chant release init turns on supply-chain for a new project. Recommended: yes for new projects, no change for existing ones.

Activity

  1. added
    epic:ci-hardening
    on Nov 21, 2026
  2. changed the title [-]release publish: scan staged images before reveal under supply-chain[/-] [+]release publish: scan every artifact before the stage, with a pinned scanner, under supply-chain[/+] on Nov 21, 2026
  3. lex00 commented on Nov 22, 2026

    @lex00
    ContributorAuthor

    Decision on chant release init and supply-chain, made from the code at 3bf0df0: init does not turn the group on, for new projects or existing ones. It prints a note that names the group and what it adds (the scan before the stage, the SBOM refusal, Sigstore signing, --require-provenance), so a team turns it on with one line in chant.workspace.json.

    Why not the recommended "yes for new projects":

    • Security groups are read from the workspace declaration (securityGroupsIn in workspace/security.ts). For a single release, init writes chant.config.ts and the workflow and no chant.workspace.json (cli/handlers/release-init.ts); only a train gets one. Turning the group on for a single release would mean init starts writing a declaration it does not write today, and the two shapes would differ in their defaults.
    • Under supply-chain an npm target refuses a package that carries no SBOM at its root (packageSbom(..., ctx.requireSbom === true) in publish-npm.ts, publish-sbom-missing). Init plans npm targets with no sbom and adds no step that writes one into the package, so most new npm projects and every new npm train would fail their first publish.
    • The group also adds --require-provenance to the rendered publish and refuses a workstation publish once signing is on. Init's workflow grants the OIDC token, so that part would work, but a first publish run by hand from a laptop would not.

    The scan in this issue follows the group: release.scan is on under supply-chain and can be turned on alone with release.scan in chant.config.ts, as release.signing is for signing. If init later writes the SBOM step for npm packages, turning the group on for new trains can be revisited in its own issue.

  4. lex00 commented on Nov 22, 2026

    @lex00
    ContributorAuthor

    Corrections from building it:

    • A helm target's oci pushes a chart archive as an OCI artifact, not an image built by release.images, so there is no local image archive to scan there. The scan covers each oci target's image, the SBOM each forge target attaches, and the SBOM each npm package carries (or, with none, one written from the member's lockfile). The images a chart deploys are scanned through their own oci targets.
    • The scan's policy is the project's existing vulnPolicy in chant.config.ts (failSeverity, fixableOnly, failOnKev, EPSS thresholds, vexSources), so there is no second set of gate settings under release.scan. release.scan is true, false, or { db } for an offline database directory.
    • The layer SBOM replaces the lockfile SBOM when the publish scans (syft is then present and checked). A publish that does not scan keeps the lockfile SBOM, so projects without the scan need no new tool.
    • The findings referrer (scan.json) goes on images only. Forge assets and npm packages have their findings in the scanned or scan-failed line of _releases/publishes.jsonl.
  5. lex00 commented on Nov 22, 2026

    @lex00
    ContributorAuthor

    Decision on development dependencies in the npm target's scan, after the first releases with supply-chain were refused for tinypool 1.1.1 (GHSA-5gmw-xhrv-c9v3, GHSA-85c8-ppgw-ccpr), which only vitest brings in.

    For an npm package that carries no SBOM, scanSubjects in publish-npm.ts writes one through memberSbom from the nearest package-lock.json, and parseNpmPackageLock puts every entry of that lockfile in it. In a workspace that is the whole repository: every member's dependencies and every development dependency, all under the subject <package>@<version> and reported as "the lockfile of" that package. That was not a choice made for scanning. The parser ignores the dev flag and the package's place in the lockfile because it was written for generate-sbom over a source tree.

    The docs describe the lockfile SBOM as listing the declared dependencies of what is published (reference/publish-targets, guide/security-supply-chain), and the document names one package as its subject. A consumer who installs that package never installs its development dependencies or the other members' dependencies, so the release gate was blocking on code the artifact does not contain. Keeping the current behaviour would need the docs to say the SBOM lists the workspace and the policy to grow a scope, and the SBOM would still mislabel its subject.

    So the npm target's lockfile SBOM will list what the package brings to a consumer: the package's dependencies, optionalDependencies and required peerDependencies, resolved through the lockfile from the package's own entry as npm resolves them, transitively, with linked workspace members followed. Development dependencies, and packages only other members need, are left out. The scan then blocks on exactly that list, with the default policy unchanged. A package that carries its own SBOM is still scanned as it is, and the docs will tell such packages to write it with npm sbom --omit dev. Scanning build-time dependencies stays available outside the release gate, through a component's generate-sbom and vuln-gate steps over the repository. The OCI and forge targets are unchanged: an image is scanned from its layers, and their lockfile SBOM does not name a single npm package.

  6. lex00 commented on Nov 22, 2026

    @lex00
    ContributorAuthor

    Decision on scanning at the cut, after the first two releases with supply-chain on (plywood 0.4.1, sql-yodeler 0.15.0) were refused by the publish job's scan with publish-scan-failed once the cut job had already pushed the release tag and the cut line. Each left a tag with nothing published behind it, and the next attempt needed a new version. Made from the code at 1f19ae3.

    Where things happen today. cutRelease (lifecycle/release-cut.ts) builds the release.images archives and the release.artifacts files in prepare, runs release.check, compiles, builds component artifacts, makes the release, runs the npm target's image check (#4941), signs, and then writes the release file and the cut line to the local chant/lifecycle branch. The handler (runReleaseCut in cli/handlers/release.ts) then pushes chant/lifecycle and makes the tag; the release workflow's cut job pushes the tag after that. A train runs chant release cut <label> --at <commit> --yes in each member, so each member's cut pushes its own cut line, and the train pushes every member's tag and release-train/<env>/<id> in one atomic push at the end. A ci serve --release host runs the rendered dispatch shape's cut job, which runs the same chant release cut.

    What changes:

    • The cut runs the scan the publish runs, over the same release.publish targets, once the release is made (so the image archives, the files and the component artifacts are all known) and before it is signed, written to chant/lifecycle, pushed or tagged. It scans what scanBeforeStage scans: each oci target's archive through an SBOM of its layers, the SBOM each forge target attaches, and the SBOM each npm package carries or the one written from the lockfile. Same vulnPolicy, same VEX files, same scanner (grype or trivy, with the Wiz image scanner wrapper from ci hooks: Sonar, Mend and Wiz presets, with findings in the plan note and scan gate #5451 when release.scan.imageScanner is wiz), and the same database age bound from release.scan.dbMaxAgeHours or a security profile.
    • The scan context is built by one function that both preparePublish and the cut call, so the two cannot drift.
    • Whether the scanner can run, and whether every VEX file is there, is checked before anything is built, in the dry run too, so chant release cut <label> without --yes says so before the label is spent.
    • A target whose subjects can't be read at the cut for a reason that is not the scan's (a file the publish job builds, say) is left to the publish's scan, and the cut prints a line naming it. The cut does not refuse what it did not refuse before for a reason other than a finding.
    • The publish keeps its own scan. It runs later, possibly with a newer database, and a release cut on a host, by hand, or resumed must still be gated there. No command runs the cut and the publish in one process, so there is no double scan to avoid.
    • No --no-scan. release.scan: false stays the one switch, and it turns off both.

    Refusal codes. The cut keeps the publish's codes: publish-scan-failed for a finding the policy blocks, publish-scan-db-stale, publish-scan-tool-missing, publish-scan-tool-failed and publish-scan-vex-missing. That is the convention the cut already follows when it runs a publish target's own check early, so the label is not spent on a release the publish would refuse: publish-npm-carries-image (#4941), publish-npm-never-published (#5230) and publish-forge-notes-missing (#5319). It also keeps the control mapping in workspace/security-controls.ts, which names publish-scan-db-stale, true for both places. A cut-specific release-scan-* code would collide with the release-scan-* codes chant release scan already uses, where release-scan-db-stale means a rescan that is recorded and not a pass. The message starts with "no release was cut:", lists every blocking finding the way the publish does, and says nothing was recorded, tagged or pushed. The stamped files are put back as on any other refusal.

    A train. A member whose scan refuses fails its cut, so the train stops with no tag pushed: the tags go out together at the end. Members cut before it have pushed their cut lines, as with any other member failure, and a run of the train again at the same commit takes them as they are. A refused train at a commit that is then fixed is a new commit, and those members' labels are floored past, which is the train's existing rule for a member that fails; nothing was published under them.

    Workflows. The rendered cut job already installs the pinned grype and syft on GitHub, GitLab and Forgejo, for a single release and for a train (the scan feature's setup goes to every job that runs chant release), and the host installs them for the cut job too. So no rendered workflow changes; a test will hold the cut job's installs. A workstation cut under supply-chain now needs grype and syft, as chant release doctor already reports. chant's own train does not scan, so its publish.yml does not change.

    A product repository gets this with the next chant release and nothing else: its cut job already has the scanner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:ci-hardening

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions