Repository navigation
Accept SPDX 3.0 patch releases above 3.0.1 - #434
aurangzaib048 wants to merge 5 commits into
Conversation
SPDX_SCHEMAS is keyed by exact version, so a 3.0.2 document matched no schema and was refused as unsupported, while the sbomify backend holds the same document to the 3.0.1 schema and accepts it. A 3.0 patch above the newest bundled one now uses the 3.0.1 schema. That schema pins @context to the 3.0.1 URL, so for these documents the pin accepts the document's own patch context as well, and nothing else. The SPEC_VERSION hint now offers SBOM_FILE for such a version too.
Match the backend exactly. A 3.0 patch above 3.0.1 is held to the 3.0.1 schema unchanged, so it passes while it keeps the 3.0.1 context and is refused when it declares a later patch context, as the backend refuses it.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Aligns SPDX 3.0.x patch handling with the sbomify backend so newer 3.0 patch documents (e.g., 3.0.2) validate against the newest bundled 3.0 schema instead of being rejected as “unsupported”.
Changes:
- Add SPDX schema version resolution to map later 3.0 patch spec versions to the bundled 3.0.1 schema.
- Update CLI hinting so later 3.0 patches are offered
SBOM_FILEguidance. - Add/adjust tests and documentation to cover/describe later SPDX 3.0 patch acceptance behavior.
| File | Description |
|---|---|
sbomify_action/validation.py |
Introduces spdx_schema_version() and uses it to pick a schema for later SPDX 3.0 patch versions. |
sbomify_action/cli/main.py |
Uses schema resolution logic to decide whether to offer SBOM_FILE for SPDX 3.x versions. |
tests/test_validation.py |
Adds acceptance tests for SPDX 3.0.2 held to the 3.0.1 schema/context rules. |
tests/test_config.py |
Ensures CLI error text offers SBOM_FILE guidance for SPDX 3.0.2. |
README.md |
Documents that SPDX 3.0.1 and later 3.0 patches are accepted for JSON-LD uploads. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
User-facing docs and CLI hints should explicitly mention the pinned @context requirement for later SPDX 3.0.x patches to avoid misleading users into thinking any 3.0.2 document will validate.
Review effort: Lite
Findings: 1
Open (3)
A 3.0 patch above the newest bundled one is held to the newest bundled schema, which pins @context to its own URL. The configuration hint offered SBOM_FILE for such a version without saying so, and the README listed "later 3.0 patches" with no condition, so a 3.0.2 document declaring the 3.0.2 context would hit a schema error neither had warned about. The hint now adds, only when the requested version maps to an older bundled schema, that an SBOM_FILE at that version validates only if it keeps that schema's @context. The README row states the same condition. The comment on the patch mapping no longer names 3.0.1, since the newest bundled schema is derived and will move when another is bundled.
There was a problem hiding this comment.
🟢 Approval recommended
The SPDX 3.0 patch schema-mapping behavior is implemented consistently across validation and CLI messaging, with targeted tests and documentation updates covering the intended acceptance rules.
0 open findings
3 resolved since last review
🧠 Review effort: Lite
|
@vpetersson-bot could you review this one? Copilot has no open findings on the current head and CI is green. |
vpetersson-bot
left a comment
There was a problem hiding this comment.
@aurangzaib048 this looks correct to me. Approving.
What I checked on c0d54aa:
spdx_schema_versionmaps 3.0.0 and 3.0.1 to themselves, any 3.0.N with N >= 1 to the newest bundled 3.0 schema, and returns None for 3.0.02, 3.0.2-rc1, 3.1 and whitespace-padded input._NEWEST_SPDX30comes from the registry, so bundling 3.0.2 later moves it without any further edits.- A 3.0.2 document that keeps the 3.0.1
@contextvalidates. If you parse it withparse_spdx3_fileand write it back out withwrite_spdx3_file, which is the augmentation path, it keeps the 3.0.1 context andspecVersion: 3.0.2and still validates. So augmenting it doesn't break validation further down. - The new acceptance tests in
tests/test_validation.pyandtests/test_config.pyfail when I run them against master'ssbomify_action/, and they pass on this branch. - Locally, ruff check, ruff format --check and mypy are clean, and the validation, config and schema-compliance tests pass (166). On the full suite, 3889 pass. Three fail, and none of them comes from this PR: two
uv buildtests intest_tool_manifest.pyhit a problem with my host's uv setup, andtest_generate_uses_first_matching_generatorneeds cdxgen/syft, which I don't have installed. That last one fails on master too.
Two non-blocking nits:
sbomify_action/validation.py:307: the success log says "validated successfully against SPDX 3.0.2 schema", but the schema actually used was 3.0.1. Logging the resolved schema version, e.g. "SPDX 3.0.2 (3.0.1 schema)", would be more accurate when someone is debugging a context-pin failure.tests/test_validation.py:481:result.error_message or ""would also pass if the result were skipped (valid is None). Addingself.assertIs(result.valid, False)would make the test confirm the document got as far as schema validation.
The branch is 2 commits behind master (the urllib3 bump), and GitHub reports it as mergeable.
This branch checks every SPDX 3 document against its schema before upload. Without sbomify#434, a 3.0.2 or later document has no bundled schema, so the check would hold back a document the backend accepts. Merging sbomify#434 here means the two land together, whichever merges first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check this branch adds would hold back a 3.0.2 document under the 3.0.1 @context without sbomify#434's acceptance. This pins the two together: it fails if either half goes missing. Co-Authored-By: Claude Opus 5.5 <[email protected]>


What was wrong
SPDX_SCHEMASis keyed by exact version, so a 3.0.2 document matched no schema and was refused as unsupported. The sbomify backend checks the same document against the 3.0.1 schema and accepts it. The upload tool refused a document the upload endpoint takes.The fix
A 3.0 patch above the newest bundled one uses the 3.0.1 schema, unchanged, as the backend does. The schema's
@contextpin stays on the 3.0.1 URL, so a 3.0.2 document that keeps the 3.0.1 context passes, and one that declares a 3.0.2 context is refused on both ends. The SPEC_VERSION hint offers SBOM_FILE for such a version too.Verified
A 3.0.2 document with the 3.0.1 context validates, which is what the backend's own 3.0.2 test sends. A 3.0.2 context is refused with a schema error, not "not supported", and a schema violation still fails. The acceptance test fails on master.