Skip to content

Conversation

@AradhyaTiwari10
Copy link
Contributor

This change updates SBOM generation to mark all components that appear only in devDependencies as "excluded", following the CycloneDX specification.

Details
Added a check for data.dev and data.devOptional flags in makeComponentWithPackageData.
Set component.scope = Enums.ComponentScope.Excluded for those components.
Ensures accurate differentiation between runtime (required) and development-only (excluded) dependencies.

Testing
All unit and integration tests pass (npm run test).
No lint errors except known deprecation warnings.
Related issue
Closes #1151

Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
…etadata

Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
…roducible condition

Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
Signed-off-by: AradhyaTiwari10 <aradhyafcb@gmail.com>
@AradhyaTiwari10 AradhyaTiwari10 requested a review from a team as a code owner October 29, 2025 20:50
@jkowalleck jkowalleck changed the title feat: set devDependencies component.scope to excluded feat: set devDependencies component.scope to excluded Oct 30, 2025
@jkowalleck jkowalleck added enhancement New feature or request hacktoberfest labels Oct 30, 2025
Copy link
Member

@jkowalleck jkowalleck left a comment

Choose a reason for hiding this comment

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

thank you for the feature. solution looks promising.
just some small optimizations needed, and please revert the unintended changes that were not in the ticket's scope.

bom.metadata.tools.components.add(toolC)
}
if (!this.reproducible) {
if (this.reproducible) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be an unintended change.
Please revert

} else {
bom.serialNumber = Utils.BomUtility.randomSerialNumber()
bom.metadata.timestamp = new Date()
bom.metadata.properties.add(
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be an unintended change.
Please revert

}
// endregion metadata

// endregion metadata
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be an unintended change.
Please revert

PackagePrivate = 'cdx:npm:package:private',
PackageDevelopment = 'cdx:npm:package:development',
PackageInstallPath = 'cdx:npm:package:path',
BomReproducible = 'cdx:reproducible',
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be an unintended change.
Please revert

component.scope = Enums.ComponentScope.Excluded
} else if (isOptional) {
component.scope = Enums.ComponentScope.Optional
} else if (data.dev === true || data.devOptional === true) {
Copy link
Member

Choose a reason for hiding this comment

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

lets have a const for the term data.dev === true || data.devOptional === true - list like isOptional.
Could you add this const and use it where possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: set devDependencies component.scope to excluded

2 participants