feat(spdx): extract creator tool and organization from SPDX 2.2 SBOMs#1783
Conversation
Add CreatorTool and CreatorOrganization properties to SpdxComponent. Extract them from creationInfo.creators[] entries prefixed with `Tool: ` and `Organization: ` respectively. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds support in the SPDX 2.2 detector/component model to extract and surface the SBOM creator tool and organization from creationInfo.creators, improving the metadata captured for SPDX documents.
Changes:
- Extend
SpdxComponentwithCreatorToolandCreatorOrganizationfields (omitted from JSON output when null). - Update
Spdx22ComponentDetectorto parseTool:andOrganization:creator entries (first match wins). - Add unit tests covering creator extraction scenarios and update SPDX detector documentation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/Microsoft.ComponentDetection.Detectors.Tests/SPDX22ComponentDetectorTests.cs | Adds tests asserting creator tool/org extraction across several creator-array scenarios. |
| src/Microsoft.ComponentDetection.Detectors/spdx/Spdx22ComponentDetector.cs | Parses creationInfo.creators for Tool: and Organization: and stores results on the component. |
| src/Microsoft.ComponentDetection.Contracts/TypedComponent/SpdxComponent.cs | Adds new serialized fields for creator tool/organization metadata. |
| docs/detectors/spdx.md | Documents newly extracted creator tool/organization metadata. |
- Add #nullable enable/disable around CreatorTool/CreatorOrganization (string?) - Check creator.ValueKind before GetString() to handle non-string elements - Use Trim() and IsNullOrWhiteSpace to treat whitespace-only values as null - Add test for whitespace-only creator values Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1783 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Extracts
CreatorToolandCreatorOrganizationfrom thecreationInfo.creatorsarray in SPDX 2.2 JSON SBOMs.Changes
CreatorToolandCreatorOrganizationproperties (nullable, omitted from JSON when null viaJsonIgnore(WhenWritingNull))Tool:andOrganization:prefixed entries from the SPDXcreatorsarray (first match wins, empty values treated as null)docs/detectors/spdx.mdto document the new fields