feat(diff): detect license changes between SBOMs#33
Open
dmchaledev wants to merge 1 commit into
Open
Conversation
The tool is positioned for supply-chain and compliance auditing, yet diff() ignored the license field entirely — a dependency silently switching from a permissive license (MIT) to a copyleft one (GPL-3.0) produced no signal at all, even though the reader already parses per-component licenses. Add license-change detection: - New LicenseChange type and ChangeReport.licenseChanges / summary.totalLicenseChanges - diff() flags components present in both SBOMs whose declared license differs. Only fires when both sides declare a license, so newly-added or dropped license metadata is not mistaken for a relicense. Independent of version, so an in-place relicense is caught even without a version bump. - Text and Markdown reports render a License Changes section; JSON gains the field automatically - Tests for detection, the version-unchanged case, the metadata-only case, and the no-change case; README documents the new report field Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012JxAhzwjGGfRAJrv1FCC6c
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.
What & why
sbom-diffis positioned for supply-chain and compliance auditing (the README's audience is "supply-chain risk analysts who need to … produce auditable SBOM diff reports for compliance evidence"). Butdiff()ignored thelicensefield entirely: a dependency silently switching from a permissive license (MIT) to a copyleft one (GPL-3.0) produced no signal at all — even though the parser already extracts a per-component license from both CycloneDX and SPDX inputs.For a compliance tool, an in-place relicense is exactly the kind of event a diff should surface, so this adds license-change detection alongside the existing added / removed / upgraded / CVE tracking.
Changes
LicenseChangetype;ChangeReport.licenseChangesandsummary.totalLicenseChanges(exported from the package entry point).Verification
npm run typecheck,npm run lint, andnpm testall pass. Verified end-to-end by building and running the CLI on two CycloneDX fixtures where one component switches MIT → GPL-3.0:The unchanged component in the same fixture produces no entry.
Backwards compatibility
Purely additive to the public API — existing report fields are unchanged. The one caveat is that
ChangeReportnow has a requiredlicenseChangesfield, so any code that hand-builds aChangeReportliteral (rather than getting one fromdiff()) will need to add it; all reports produced by this package include it.🤖 Generated with Claude Code
https://claude.ai/code/session_012JxAhzwjGGfRAJrv1FCC6c
Generated by Claude Code