Repository navigation
ci: scan the SBOM instead of the image tarball for the PR-CI report - #1714
Merged
Merged
Conversation
A report pointed at a file the job never wrote hard-fails: `exit-code: 0` suppresses findings, not scan errors. The pin was right, its rationale described a silent pass that does not exist. Refs: #1701
The report is awareness only, and its nightly twin in security-scan.yml already carries `continue-on-error`. Now that its input is produced in the same job, a scan error here must not turn the PR red. Refs: #1701
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
After #1692 split Project Checks into lanes, the run's critical path became
Build Container Image→Security Scan: 110-119 s + 336-419 s on the four most recentdevruns, against 244-288 s for the longest project lane. The Trivy DB cache already hits (Cache restored from key: cache-trivy-<date>in seconds), so the time is the 1.5 GiB tarball walk, done twice — once for the HIGH/CRITICAL/MEDIUM report (140-174 s) and once for the CycloneDX SBOM (122-152 s).The image is now parsed once. The SBOM step runs first; the report scans that SBOM (
scan-type: sbom), the patternsecurity-scan.ymlhas used since its nightly lane was built (there, the SBOM-mode scan takes 12 s).check-expirationsmoves topython-security, which already has the Nix/uv environment and does not wait onbuild-image, sosecurity-scanalso drops its 42 ssetup-env. No new job;summaryand its shape test are untouched.What changes in the report: Trivy's SBOM scanning covers vulnerabilities and licenses only, so the PR-CI report no longer runs the secret scanner. Accepted (see the issue): the report is non-blocking awareness with
exit-code: 0, the.trivyignoreregister's own RETIRED block records that the secret scanner has never found anything on this image, and the authoritative CVE gate remains the nightly vulnix lane.Finding-set equivalence, measured on the real image closure (local trivy 0.72.0, warm DB,
--severity HIGH,CRITICAL,MEDIUM --ignorefile .trivyignore):trivy image --input <tar> --format json(today)trivy image --input <tar> --format cyclonedx(new step 1)trivy sbom sbom.json --format json(new step 2)diffof[VulnerabilityID, PkgName, InstalledVersion] | sort -ubetween image mode and SBOM mode: empty. Caveats: CI pins v0.74.0; the local input was the Nix.tar.gzoutput rather than the CI/tmp/image.tarartifact (same closure).Measured on this PR's CI run: run 36151221572 —
Security Scan170 s (was 336-419 s): download 8 s, SBOM 152 s, SBOM-mode report 3 s (was 140-174 s), upload 1 s;setup-envgone. Critical pathBuild Container Image112 s + 170 s = 282 s (4m42), against 353 s for the longest project lane (Project Flake Gates, 5m53 on this run), soSecurity Scanis off the critical path. The report printed the same finding set as before;check-expirationsran inPython Security Scan(57 s).Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
.github/workflows/ci.ymlsecurity-scan:setup-envand thecheck-expirationsstep removed; SBOM step first (input: /tmp/image.tar,format: cyclonedx, noTRIVY_SKIP_*_DB_UPDATE—--format cyclonedxdisables security scanning and never populates a DB, so the report must be free to fetch one); report step nowscan-type: sbom,scan-ref: sbom-cyclonedx.json,skip-setup-trivy: true, sameseverity,exit-code: 0,trivyignores. The SBOM step'sif: always()is dropped (it only survived a failing predecessor it no longer has); the upload keepsif: always(), name and path unchangedpython-security:check-expirations .trivyignore .vulnixignoreadded right after itssetup-env, still blockingtests/test_workflow_security_scan_report.py(new, usestests/workflow_scaffoldhelpers)python-securityand absent fromsecurity-scan; nothing insecurity-scanusessetup-envoruv run; SBOM step precedes the report and the report'sscan-refequals the SBOM step'soutput; severity /exit-code: 0/trivyignoreskept; artifact keeps thesbom-prefix, path equals the SBOM output, upload keepsalways(). RED ondev's ci.yml: 4 failed / 1 passeddocs/CONTAINER_SECURITY.mdChangelog Entry
No changelog needed — CI-internal change; nothing a consumer receives differs (the issue says so too).
Testing
just test)Manual Testing Details
actionlint .github/workflows/ci.ymlcleanuv run pytest tests/test_workflow_security_scan_report.py tests/test_workflow_summary_gate.py tests/test_workflow_zizmor_baseline.py tests/test_workflow_sbom_ordering.py tests/test_workflow_expiry_notice.py -q→ 81 passed; whole suite minus image/integration → 1191 passed, 1 skippedprek run --all-files→ all hooks passedChecklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
python-securityis gated ontest-suite == 'project'andsecurity-scanon'image', so a manualworkflow_dispatchwithtest-suite: imagealone no longer runscheck-expirations; pull-request and push runs execute both jobs, and the pre-commit hook plus both nightly lanes still cover the registers. Follow-up if wanted: an image-mode--scanners secretpass in the nightly, which already builds the tarball.Refs: #1701