COR-1258: generate CycloneDX SBOMs alongside scan reports - #142
Open
juangaitanv wants to merge 6 commits into
Open
COR-1258: generate CycloneDX SBOMs alongside scan reports#142juangaitanv wants to merge 6 commits into
juangaitanv wants to merge 6 commits into
Conversation
Add `corgea scan --sbom [FILE]` (default bom.json): after a blast scan
completes, generate a CycloneDX SBOM locally from the project tree via
the offline deps engine, alongside any --out-format report.
- Upgrade the CycloneDX emitter from bare 1.4 to spec 1.7: serialNumber,
metadata (timestamp, tool, root component), bom-refs on components,
dependsOn grouped per ref. Output validates against the official
bom-1.7 JSON schema.
- Maven: resolve ${property} / ${project.version} version placeholders
and emit root->dependency graph edges (dependencies array was always
empty for pure-Maven projects).
- Warn on stderr when detected ecosystems (Go, Cargo) are not included
in the SBOM, instead of silently emitting an empty-looking document.
- Error cleanly (exit 2) on nonexistent paths in deps subcommands.
- Tests: e2e scan --sbom against the HTTP stub, Maven property/edge
coverage, warning + path-error CLI tests, emitter unit tests. Scrub
GIT_* env in the repo-info test so it passes inside git hooks.
…inherited-version deps
- Omit component version/purl when the version is unresolved (? placeholder
or ${...} Maven property) instead of emitting null versions and invalid
@? purls; bom-ref keeps the internal id.
- Dedup components by bom-ref and dependsOn per ref (schema uniqueItems).
- Maven: project.version falls back to the parent's version for child POMs
and resolves through properties (${revision} CI versioning).
- scan --sbom write failures exit 1 with a clean error instead of panicking.
All emitter outputs re-validated against the official bom-1.7 schema.
added 2 commits
July 30, 2026 13:51
unsupported_ecosystem_label re-encoded which ecosystems produce graph nodes; derive it from ecosystems::is_graphed, defined beside the scanner dispatch so a future Go/Cargo scanner updates both in one place.
- dependencyManagement entries no longer emit components/edges; their
versions fill versionless direct declarations in the same POM.
- Property values resolve to a fixed point (bounded, cycle-safe) so
chained ${...} references fully substitute.
- Empty versions count as unresolved in the SBOM emitter (no bare @ purls).
Parent/imported BOM resolution stays deferred to COR-1733.
added 2 commits
July 30, 2026 16:23
…lution
- to_cyclonedx filters the synthetic root by id, not display name, so a
real package named 'root' keeps its component (no dangling dependsOn).
- pom_project_version stops at the first nested section
(dependencyManagement/build/reporting/profiles) so plugin versions can't
hijack ${project.version}; parent fallback unchanged.
- Property fixed-point resolution re-runs after project.version is
inserted so properties aliasing ${project.version} resolve.
split_dependency_management and pom_project_version's parent handling used the same find-open/find-close/remove-section scanning; extract it into split_section. Compare the synthetic root via PackageId::root() instead of a raw string literal, matching the rest of the codebase.
leenk7991
approved these changes
Jul 30, 2026
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
Implements COR-1258: generate a CycloneDX (1.7, latest) SBOM immediately after a scan, alongside the SARIF report.
corgea scan --sbom [FILE]flag (defaultbom.json): after the blast scan completes and any--out-formatreport is written, a CycloneDX SBOM is generated locally from the project tree via the offlinedepsengine — no server changes, no network.serialNumber(urn:uuid),metadata(timestamp, tool, root component),bom-refon every component,dependsOngrouped per ref. Output validates against the officialbom-1.7.schema.json;corgea deps sbomshares the same emitter.${property}/${project.version}version placeholders now resolve before purl construction, and the scanner emits root→dependency edges (thedependenciesarray was always empty for pure-Maven projects).depssubcommands error cleanly (exit 2) on nonexistent paths instead of succeeding with empty output.Compliance enrichment (licenses, scope, hashes, Go/Cargo coverage) is tracked separately in COR-1733.
Test plan
cargo test— 543 passed, 0 failed (clippy clean, fmt clean)tests/cli_scan_sbom.rs: full stubbed scan flow → defaultbom.json, custom filename, no file without the flagmaven_tests.rs+ newjava-maven-propsfixturecli_deps.rs