test(sbom): pin declared-dependency SBOM for native Maven uploads (#870)#222
Merged
Conversation
Adds tests/security/test-sbom-declared-deps.sh, a release-gate E2E that proves
the declared-dependency SBOM source landed in artifact-keeper#870 / PR #1553.
A Maven jar PUT does not trigger a scan, so there are no scan_packages rows.
Before the fix the SBOM read path returned an empty component list and the
customer fetched "components": [] for an artifact whose POM names real
dependencies. The test publishes a placeholder jar plus a POM declaring two
compile dependencies (one ${property}-versioned, one literal) and one
test-scoped dependency, then asserts:
- POST /api/v1/sbom returns component_count >= 2
- the property-versioned guava resolves to pkg:maven/com.google.guava/guava@32.1.3-jre
(exercises the storage POM fallback + <properties> interpolation)
- commons-lang3 appears with its maven purl
- the test-scoped junit-jupiter is excluded
- the document carries a declared/partial completeness signal, never an
authoritative "complete" with an empty inventory
Gated behind a new require_feature flag sbom_declared_dependencies (>= 1.2.0)
so pre-fix backends skip loudly instead of flapping. Auto-discovered by the
security suite, which release-gate.yml already runs.
Closes #220
… set The release gate resolves require_feature via the branch-aware AK_FEATURES env (feature-flags.sh), not the version probe. Without registering the new flag in AK_BACKEND_BRANCH_1_2_X, the gate treated it as explicitly-disabled and skipped test-sbom-declared-deps.sh on main/1.2.x. Add it so the test runs against a backend carrying artifact-keeper#870 (PR #1553).
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.
Summary
Adds a release-gate E2E that pins the declared-dependency SBOM invariant for native Maven uploads, the exact gap #220 describes.
A Maven jar
PUTdoes not trigger a scan, so there are noscan_packagesrows. Before the fix the SBOM read path returned an empty component list, and a customer fetched"components": []for an artifact whose POM names real dependencies. The companion backend fix (artifact-keeper#1553, closes artifact-keeper#870) adds a declared-dependency source so the SBOM is populated from the POM regardless of scanning. This test pins that behavior.What the test does (
tests/security/test-sbom-declared-deps.sh)Publishes a placeholder jar plus a POM declaring two compile dependencies (one
${property}-versioned, one literal) and one test-scoped dependency, then asserts:POST /api/v1/sbomreturnscomponent_count >= 2pkg:maven/com.google.guava/guava@32.1.3-jre(exercises the storage POM fallback and<properties>interpolation in the backend fix)declared/partialcompleteness signal, never an authoritativecompletewith an empty inventoryWhy it complements the existing gate
tests/release-gate/sbom-correctness-gate.shcovers the npm + lockfile, scanner-derived path. This covers the opposite case the existing gate cannot: declared dependencies with no scanner inventory at all.Portability
Gated behind a new
require_feature "sbom_declared_dependencies"flag (min backend1.2.0, registered intests/lib/common.sh) so pre-1.2.0 backends skip loudly instead of flapping on the structurally-empty case. The test is auto-discovered by thesecuritysuite, whichrelease-gate.ymlalready runs.Note: #220 was written assuming this slipped to v1.2.1. The backend fix landed for v1.2.0 (artifact-keeper#1553), so the feature gate targets
1.2.0.Validation
bash -n: cleanshellcheck tests/security/test-sbom-declared-deps.sh: clean (exit 0)Closes #220