Skip to content

feat(spdx): extract creator tool and organization from SPDX 2.2 SBOMs#1783

Merged
grvillic merged 3 commits intomicrosoft:mainfrom
alisonlomaka:alisonlomaka/spdx-tool-org
Apr 17, 2026
Merged

feat(spdx): extract creator tool and organization from SPDX 2.2 SBOMs#1783
grvillic merged 3 commits intomicrosoft:mainfrom
alisonlomaka:alisonlomaka/spdx-tool-org

Conversation

@alisonlomaka
Copy link
Copy Markdown
Member

Summary

Extracts CreatorTool and CreatorOrganization from the creationInfo.creators array in SPDX 2.2 JSON SBOMs.

Changes

  • SpdxComponent: Added CreatorTool and CreatorOrganization properties (nullable, omitted from JSON when null via JsonIgnore(WhenWritingNull))
  • Spdx22ComponentDetector: Parses Tool: and Organization: prefixed entries from the SPDX creators array (first match wins, empty values treated as null)
  • Tests: Added coverage for tool/org extraction, missing creationInfo, multiple creators, and edge cases
  • Docs: Updated docs/detectors/spdx.md to document the new fields

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SpdxComponent with CreatorTool and CreatorOrganization fields (omitted from JSON output when null).
  • Update Spdx22ComponentDetector to parse Tool: and Organization: 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.

Comment thread src/Microsoft.ComponentDetection.Contracts/TypedComponent/SpdxComponent.cs Outdated
alisonlomaka and others added 2 commits April 16, 2026 12:32
- 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>
Copilot AI review requested due to automatic review settings April 17, 2026 13:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@grvillic grvillic merged commit 87ae1f8 into microsoft:main Apr 17, 2026
25 of 26 checks passed
@github-actions
Copy link
Copy Markdown

👋 Hi! It looks like you modified some files in the Detectors folder.
You may need to bump the detector versions if any of the following scenarios apply:

  • The detector detects more or fewer components than before
  • The detector generates different parent/child graph relationships than before
  • The detector generates different devDependencies values than before

If none of the above scenarios apply, feel free to ignore this comment 🙂

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.0%. Comparing base (810548e) to head (93a2320).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #1783   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants