Skip to content

Add CVE Watch scanner and isolated CI workflow - #26

Merged
eriknordmark merged 5 commits into
lf-edge:masterfrom
shjala:add-cvewatch
Nov 16, 2026
Merged

eriknordmark merged 5 commits into
lf-edge:masterfrom
shjala:add-cvewatch

Conversation

@shjala

@shjala shjala commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

EVE's CVE gate currently depends on a workflow in a personal repository and accepts exceptions from the PR being scanned. This imports the standalone CVE Watch scanner into eve-tools and requires approved base-branch exceptions, so a PR cannot suppress its own new findings.

The scanner is imported from shjala/eve-cvewatch commit 28cc815e253a996d203396435620db717c908542 (merged PR #5). Tools, tests, and documentation live under cvewatch/; .github/workflows/cve-scan.yml exposes the reusable gate.

  • PR and baseline builds run in separate disposable jobs. A fresh job scans only their data artifacts using the defining workflow's exact checkout. Permissions are read-only and checkout credentials are not persisted.
  • Resolve the target base branch tip before either build runs. Pin the baseline SBOM and approved .cve-ignore to that same full SHA.
  • Fetch .cve-ignore independently from Git in the trusted scanner job without checking out or executing source code. Ignore policy files supplied by either build artifact. Missing policy means no exceptions; retrieval errors and invalid files fail the run. Include the applied policy and commit provenance in the report artifact.
  • Exception changes should be reviewed and merged in a separate PR before rerunning a feature PR. Adding an exception in the feature PR itself cannot suppress its findings. Reviewers enforce the separate-PR convention; there is no policy-only changed-file restriction.
  • Reject missing or malformed defining-workflow identity before any checkout. Require Re-run all jobs so baseline resolution and artifacts belong to the current attempt. Accept only master or numeric X.Y-stable base branches.
  • Document global ID/alias exceptions, artifact collision denial of service, and the published-image/source-build baseline difference; prominently log source-build fallback.
  • Keep local, daily, and historical scan helpers. Local PR scans use the same base-policy selection rule and remain for trusted source input. No production service or credentials are required for PR scans.

Validation: all 83 local regressions pass, including real Git branch-tip/pinning checks, build/scan isolation, policy retrieval failures, and a comparison test proving PR/build-artifact exceptions cannot bypass the gate. A live policy fetch against EVE master also passed without checking out its source. Bash syntax and git diff --check pass. Actionlint 1.7.12 passes with only its unknown-property warnings for GitHub.com's documented job.workflow_repository and job.workflow_sha contexts excluded.

The imported source commit previously passed simulated CI with published EVE release and master images and live feeds, including positive/negative/ignore gates and malformed-input failure. That live-feed simulation and full EVE source builds were not repeated for this migration.

Untrusted builds can still fabricate their own SBOM; source review remains necessary. They cannot supply the exception policy used by the trusted scan job. The reusable workflow requires GitHub.com. This PR does not switch EVE's caller; the dependent draft lf-edge/eve#7073 will pin the merged upstream commit before activation.

The dependent EVE draft #7073 also now runs for new commits and PR edits and cancels superseded PR checks. It remains a draft with the upstream pin/base-input switch pending merge. Package-scoped exceptions and enforced expiry remain deferred format changes; no scanner matching behavior was changed.

Import the standalone scanner from shjala/eve-cvewatch at 28cc815e253a996d203396435620db717c908542. Keep tools and documentation under cvewatch while exposing the reusable workflow at the repository root.

Build PR and baseline inputs in isolated jobs and scan their data on a fresh runner. Preserve the source scanner behavior and adapt workflow paths and regression tests for the new layout.

Validation: 71 local regressions, Bash syntax, and actionlint with only its documented workflow context warnings excluded. The source commit was also validated with published EVE release and master images.
Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
Resolve the base branch tip before builds and use the same commit for baseline inputs and the exception policy. Fetch .cve-ignore directly from Git in the trusted scanner job, ignoring policy files supplied by either build artifact.

Require exception changes to be reviewed and merged into the base branch before they can suppress findings in another PR. Document the separate-PR workflow. Fail on policy retrieval errors and retain policy commit provenance with reports.

Validation: 80 regressions including real local Git and gate bypass cases; successful policy fetch against EVE master; Bash syntax and workflow lint.
Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trust split looks right: fork code builds on a disposable read-only runner, the scan runs on a fresh runner from the workflow's own checkout, and .cve-ignore is read from Git at a base SHA pinned before either build. I found no way for a PR to apply its own exceptions. Points below; 2 and 9 may belong on lf-edge/eve#7073 rather than here, since they are about how the caller invokes this workflow.

Before merge

  1. "Re-run failed jobs" likely can't work. Artifacts are named cve-input-{role}-${{ github.run_attempt }}. Re-running only pr-scan looks for cve-input-pr-2 while the un-rerun builds uploaded -1, and it reuses resolve's old base_sha, so a newly merged exception still wouldn't apply. (Reasoned from re-run semantics, not tested.) Either document "Re-run all jobs" in the exception flow, or have pr-scan fail with a message saying so.

  2. The PR author chooses the baseline. base_ref comes from pull_request.base.ref, and the caller doesn't pass eve-base-ref. Retargeting the PR to another lf-edge/eve branch changes both the baseline (an older branch with more known CVEs hides new ones) and which .cve-ignore applies. With the pull_request_review trigger, retarget → review → retarget back to master leaves the green result in place. Ancient branches likely fail to build (fails closed), but recent *-stable branches would build. Suggest accepting only master and *-stable in resolve_inputs.py, and/or having the caller pin the base.

  3. Exceptions are global per vulnerability ID. is_ignored matches ID and aliases only, so an entry approved for CVE-X in package A also suppresses CVE-X in package B, and a GHSA entry suppresses its aliased CVE. Consider scoping entries to a package (e.g. CVE-X pkg:apk/alpine/foo), or at least documenting it. An optional reason/expiry column would keep the list from only growing.

Hardening / minor

  1. The checkout relies on job.workflow_repository/job.workflow_sha being non-empty. If either ever evaluates empty, actions/checkout falls back to the caller repo at the PR ref, and a PR adding cvewatch/ci/* to EVE would run its own scanner in the trusted job. A one-line guard step that fails on empty values closes this.

  2. The fork build has sudo on a hosted runner and can read the runner's ACTIONS_RUNTIME_TOKEN, so it could upload cve-input-base-N ahead of the base job. That only makes the base upload collide and the gate fail, and gains nothing over faking its own SBOM, but it is worth a line in the threat-model docs.

  3. The master baseline SBOM comes from the published image (docker run … sbom) while the PR side is make … pkgs sbom from source. Differences between the two generators show up as noise or misses; scanner-parity-review.md touches this, but it would help to say which side is authoritative.

  4. lfedge/eve:0.0.0-master-<sha8>-kvm-amd64 usually isn't published until a while after merge, so scans in that window silently build master from source. Correct but slow; worth logging prominently. The "immutable image identity" comment in get_sbom.sh is a mutable tag.

  5. New files carry Copyright (c) 2026 Zededa, Inc.; check that matches eve-tools convention. Consider adding cvewatch/ owners to MAINTAINERS.md.

  6. Caller-side, pre-existing: triggering on pull_request_review: submitted means commits pushed after the last review are never scanned. Worth fixing while #7073 changes the caller.

Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>
@shjala
shjala requested a review from eriknordmark November 16, 2026 11:42
Signed-off-by: Shahriyar Jalayeri <shahriyar@posteo.de>

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
I manually ran it throrugh the same workflow linters as we use in EVE with no noticable issues.

@eriknordmark
eriknordmark merged commit 11f157a into lf-edge:master Nov 16, 2026
3 checks passed
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.

2 participants