Skip to content

ci(security): vulnix + SBOM CVE scanning for the Nix image (#637) - #660

Merged
c-vigo merged 6 commits into
feature/625-nix-claude-migrationfrom
feature/637-vulnix-sbom-scanning
Jun 23, 2026
Merged

c-vigo merged 6 commits into
feature/625-nix-claude-migrationfrom
feature/637-vulnix-sbom-scanning

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements T3.1 (#637): a Nix image has no apt/dpkg DB, so Trivy's OS-package scanner goes dark. This replaces the primary CVE signal with vulnix (nixpkgs-native), keeps Trivy for an SBOM + defence-in-depth view, re-authors the security policy, and rebuilds the expiry-gated exception register around vulnix findings. This produces the objective go/no-go gate input for #639.

What changed

  • Nightly scan-nix-image job (security-scan.yml): builds the image package closure (new flake packages.devcontainerImageEnv) and runs vulnix as the primary scanner; emits a CycloneDX SBOM and a Trivy SBOM-mode vuln view for defence in depth; uploads both scanners' output as vulnix-vs-Trivy overlap evidence.
  • vulnix-gate (packages/vig-utils, TDD): fails on HIGH/CRITICAL (CVSS v3 ≥ 7.0) vulnix findings not covered by a non-expired exception. Reuses check_expirations.parse_entries, so .vulnixignore shares the .trivyignore Expiration: format and one expiry SSoT (wired into the pre-commit hook + ci.yml).
  • Flake: lifted shared imageTools to expose devcontainerImageEnv (accurate vulnix --closure target — the gzipped OCI tar has no scannable store refs) and a pinned packages.vulnix.
  • docs/CONTAINER_SECURITY.md: re-authored for the Nix posture — dropped the apt --only-upgrade escape hatch + "why not apt-get upgrade" section; "advance the nixpkgs rev" is the primary lever; documents dual registers and the residual Debian scan until T4.4 — Decommission the Debian path #642.

Scope guardrails

  • The gate is non-blocking (continue-on-error) during discovery: vulnix over-reports because it can't see nixpkgs' backported patches (local run surfaced ~83 HIGH/CRITICAL, mostly false positives). T4.1 — Publish-cutover to the Nix image (GATED) #639 flips it to blocking after triage + nixpkgs advance, and wires SARIF + a dedup issue.
  • .vulnixignore starts empty (header-only); findings are triaged into it before cutover.

Verified locally

  • nix build .#devcontainerImageEnv + nix run .#vulnix -- --closure ./result --json → 38 derivations, scores parsed correctly.
  • vulnix-gate against the real output flags HIGH/CRITICAL sorted by score; 509 vig-utils tests pass (12 new).
  • check-expirations .trivyignore .vulnixignore → validated.

Dependencies

Refs: #637

c-vigo added 6 commits June 23, 2026 18:34
Specify vulnix-gate: excepted_cves() reuses check_expirations.parse_entries
and drops expired exceptions; blocking_findings() flags only HIGH/CRITICAL
(CVSS >= threshold) CVEs that are not excepted, ignoring sub-threshold and
unscored CVEs; main() exits non-zero on any unexcepted HIGH/CRITICAL. Allow
the policy term 'unexcepted' in the typos dictionary.

Refs: #637
vulnix-gate loads vulnix --json findings and fails when a HIGH/CRITICAL
CVE (CVSS v3 >= threshold, default 7.0) is not covered by a non-expired
entry in the exception register. It reuses check_expirations.parse_entries
so .vulnixignore shares the .trivyignore Expiration: format and one expiry
SSoT; sub-threshold and unscored CVEs are awareness-only. This is the
objective go/no-go gate input for #639.

Refs: #637
Lift the shared imageTools (and python) to the per-system let so both the
image and a new packages.devcontainerImageEnv can use it. devcontainerImageEnv
is a buildEnv whose runtime closure equals the image's package set, giving
vulnix --closure an accurate scan target (the gzipped OCI tar exposes no
scannable store refs). Also expose packages.vulnix from the locked nixpkgs so
the nightly scan runs a reproducible scanner version.

Refs: #637
…x image

Add a scan-nix-image job to the nightly workflow: build the flake
devcontainerImageEnv closure, run vulnix (primary CVE scanner) to JSON +
table, and gate unexcepted HIGH/CRITICAL via vulnix-gate against the new
.vulnixignore register. Keep Trivy for a CycloneDX SBOM and an SBOM-mode
vuln view (defense in depth), and upload both scanners' output as the
Trivy-vs-vulnix overlap evidence. The gate is continue-on-error during
discovery (vulnix over-reports nixpkgs-patched CVEs); #639 flips it to
blocking. Wire .vulnixignore into the check-expirations pre-commit hook
and the ci.yml expiry step alongside .trivyignore.

Refs: #637
…sture

Reframe the policy around the Nix-built image: pinned nixpkgs rev as the
primary lever, nightly vulnix as primary detection, Trivy SBOM for defence
in depth, and dual .vulnixignore/.trivyignore expiry registers. Drop the
apt --only-upgrade escape hatch and the 'why not apt-get upgrade' section;
'advance the nixpkgs rev' replaces them. Note the residual Debian :latest
scan until decommission (#642). Record the change in the changelog.

Refs: #637
…' into feature/637-vulnix-sbom-scanning

# Conflicts:
#	CHANGELOG.md
#	assets/workspace/.devcontainer/CHANGELOG.md
@c-vigo
c-vigo merged commit 343234a into feature/625-nix-claude-migration Jun 23, 2026
2 checks passed
@c-vigo
c-vigo deleted the feature/637-vulnix-sbom-scanning branch June 23, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant