Skip to content

fix(provenance): verify every matched SPDX, not just the first - #11

Open
MarkAtwood wants to merge 2 commits into
masterfrom
fix/bomsh-verify-all-spdx
Open

fix(provenance): verify every matched SPDX, not just the first#11
MarkAtwood wants to merge 2 commits into
masterfrom
fix/bomsh-verify-all-spdx

Conversation

@MarkAtwood

Copy link
Copy Markdown

bomsh_verify.verify() checked only sorted(glob)[0], so when the SPDX glob matched several documents a broken or tampered SPDX that sorted later passed CI unexamined — a silent pass, the worst failure mode for a provenance verifier. Now loops over all matched documents (accumulating problems so one run reports every broken file); object-store integrity still runs once for the store.

Regression tests: a later dangling SPDX now fails the run; two valid documents both verify. Full test_gen_sbom suite green (164 tests). Independent of the other open review PRs.

Addresses SBOM-gpex.11.

sameehj and others added 2 commits July 23, 2026 15:54
Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
verify() checked only sorted(glob)[0], so when the SPDX glob matched
several documents a broken or tampered SPDX that sorted later passed
CI unexamined -- a silent pass, the worst failure mode for a provenance
verifier. Loop over all matched documents, accumulating problems so one
run reports every broken file; object-store integrity still runs once.

Adds regression tests: a later dangling SPDX now fails the run, and two
valid documents both verify.
Copilot AI review requested due to automatic review settings July 23, 2026 23:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a provenance-verification blind spot where bomsh_verify.verify() only validated the first SPDX file matched by a glob, allowing later-matched (potentially tampered/broken) SPDX documents to go unchecked.

Changes:

  • Update provenance/bomsh_verify.py to iterate over all matched SPDX files, accumulating errors and producing per-file verification messages.
  • Add regression tests ensuring later-matched broken SPDX files fail verification, and multiple valid SPDX files all pass with an aggregated summary.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_gen_sbom.py Adds regression/positive tests covering multi-SPDX glob matching behavior.
provenance/bomsh_verify.py Verifies every matched SPDX file (not just the first) and aggregates results/messages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

for spdx_path in spdx_paths:
try:
spdx_gitoids = load_spdx_gitoids(spdx_path)
except (json.JSONDecodeError, ValueError) as e:
@sameehj
sameehj force-pushed the master branch 4 times, most recently from 3ab77f9 to 9bdf5b7 Compare July 24, 2026 14:09
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.

3 participants