Skip to content

feat: collect Rust licenses from crate manifests first - #27

Open
nicu1989 wants to merge 1 commit into
eclipse-score:mainfrom
nicu1989:nicu1989_sbom_manifest_licenses
Open

nicu1989 wants to merge 1 commit into
eclipse-score:mainfrom
nicu1989:nicu1989_sbom_manifest_licenses

Conversation

@nicu1989

Copy link
Copy Markdown
Member

Pass selected Cargo.toml files to the metadata collector.
Check crate identity before using the declared license.
Fall back to exact-version API data for confirmed crates.io sources.
Record license sources and unresolved reasons.
Rate-limit API requests and retry temporary failures.

Closes: #26

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.

🟡 Changes recommended

Unresolved identity, compatibility, annotation-preservation, and HTTP error-handling issues can lose metadata or abort collection.

5 open issues
What changed in this PR

Adds manifest-first Rust license collection to the Bazel SBOM pipeline, addressing issue #26.

Changes:

  • Passes repository-associated manifests as declared action inputs.
  • Validates crate identity and records license origins or unresolved reasons.
  • Adds restricted exact-version API fallback, rate limiting, retries, and regression tests.
File Description
tests/​test_sbom_generator.py Tests repository-cache license precedence.
tests/​test_generate_crates_metadata_cache.py Tests manifest collection and API handling.
scripts/​generate_crates_metadata_cache.py Implements manifest-first metadata collection.
README.md Documents collection behavior and limitations.
internal/​rules.bzl Passes manifests and dependency data to collection.
internal/​providers.bzl Adds manifest propagation data.
internal/​generator/​sbom_generator.py Prefers repository-specific cache entries.
internal/​aspect.bzl Collects and propagates crate manifests.
defs.bzl Updates collection option documentation.

Review effort: Balanced

Comment thread scripts/generate_crates_metadata_cache.py Outdated
Comment thread scripts/generate_crates_metadata_cache.py Outdated
Comment thread internal/generator/sbom_generator.py Outdated
Comment thread scripts/generate_crates_metadata_cache.py Outdated
Comment thread scripts/generate_crates_metadata_cache.py Outdated
@nicu1989
nicu1989 force-pushed the nicu1989_sbom_manifest_licenses branch from c01c6e9 to 44d7e2b Compare October 21, 2026 12:32
@nicu1989
nicu1989 requested a balanced review from Copilot October 21, 2026 12:32

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.

Comment thread scripts/generate_crates_metadata_cache.py Outdated
Comment thread scripts/generate_crates_metadata_cache.py Outdated
@nicu1989
nicu1989 force-pushed the nicu1989_sbom_manifest_licenses branch from 44d7e2b to e18c5cf Compare October 21, 2026 13:03
@nicu1989
nicu1989 requested a balanced review from Copilot October 21, 2026 13:03

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.

🟡 Changes recommended

Identical crate versions across hubs overwrite repository records, losing checksums and disabling valid license fallback.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread scripts/generate_crates_metadata_cache.py
@nicu1989
nicu1989 force-pushed the nicu1989_sbom_manifest_licenses branch from e18c5cf to e3b81ec Compare October 21, 2026 13:42
@nicu1989
nicu1989 requested a balanced review from Copilot October 21, 2026 13:43

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.

🟡 Changes recommended

Default repository exclusions omit newly supported crate hubs from generated SBOMs.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread internal/generator/sbom_generator.py
@nicu1989
nicu1989 force-pushed the nicu1989_sbom_manifest_licenses branch from e3b81ec to a9fc0dd Compare October 21, 2026 20:00
@nicu1989
nicu1989 requested a balanced review from Copilot October 21, 2026 20:01

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.

🟡 Changes recommended

Downstream deduplication can combine a fork’s checksum with another source’s license.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread internal/generator/sbom_generator.py
@nicu1989
nicu1989 force-pushed the nicu1989_sbom_manifest_licenses branch from a9fc0dd to db6a4bf Compare October 22, 2026 07:05
@nicu1989
nicu1989 requested a balanced review from Copilot October 22, 2026 07:05

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.

🟡 Changes recommended

Metadata collection omits edge-only crate dependencies that the SBOM generator includes, leaving available licenses and checksums unused.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread scripts/generate_crates_metadata_cache.py Outdated
@nicu1989
nicu1989 force-pushed the nicu1989_sbom_manifest_licenses branch from db6a4bf to b98d2ce Compare October 22, 2026 08:17
@nicu1989
nicu1989 requested a balanced review from Copilot October 22, 2026 08:17

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.

🟡 Changes recommended

The repository-conflict check incorrectly aborts mixed-language SBOM generation when PyPI and Cargo packages share a name and version.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread internal/generator/sbom_generator.py Outdated
Pass selected Cargo.toml files to the metadata collector.
Check crate identity before using the declared license.
Fall back to exact-version API data for confirmed crates.io sources.

Record license sources and unresolved reasons.
Rate-limit API requests and retry temporary failures.

Signed-off-by: Nicolae Dicu <nicolae.dicu.ext@qorix.ai>
@nicu1989
nicu1989 force-pushed the nicu1989_sbom_manifest_licenses branch from b98d2ce to c3c336f Compare October 22, 2026 09:21
@nicu1989
nicu1989 requested a balanced review from Copilot October 22, 2026 09:21

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.

🔵 Needs a closer look

Mixed Cargo and module lockfile inputs can still discard crate checksums and disable valid license API fallback.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

Collect Rust licenses from Cargo.toml before querying crates.io

2 participants