Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mark devDependencies as "excluded" in SBOM results #1221

Closed

Conversation

ARRY7686
Copy link

@ARRY7686 ARRY7686 commented Oct 1, 2024

Description:

This pull request addresses the issue #1151, where devDependencies in the Software Bill of Materials (SBOM) were incorrectly marked as required. According to the CycloneDX specification, devDependencies should be marked with the excluded scope since they are not required at runtime but used for development or testing purposes.

Changes Implemented:

Modified the makeComponent method in src/builders.ts to set the scope of devDependencies to excluded.
Added a conditional check for dev dependencies, ensuring they are marked as excluded in the generated SBOM.
Commented out the original logic that omitted devDependencies entirely, which was not compliant with the SBOM specification.

Testing Performed:

Verified the SBOM generation for projects with both regular and devDependencies.
Ensured that regular dependencies are marked as required and devDependencies are correctly marked as excluded in the generated SBOM.
Issue Reference:
This pull request fixes #1151.

@ARRY7686 ARRY7686 requested a review from a team as a code owner October 1, 2024 12:07
src/builders.ts Show resolved Hide resolved
src/builders.ts Show resolved Hide resolved
src/builders.ts Show resolved Hide resolved
@jkowalleck
Copy link
Member

jkowalleck commented Oct 1, 2024

@ARRY7686 ,

Please sign off your commits, to show that you agree to publish your changes under the current terms and licenses of the project , and to indicate agreement with Developer Certificate of Origin (DCO).
read more here: https://github.com/CycloneDX/cyclonedx-node-npm/blob/main/CONTRIBUTING.md#sign-off-your-commits

see instructions on how to sign-off already pushed commits here: https://github.com/CycloneDX/cyclonedx-node-npm/pull/1221/checks?check_run_id=30911587611

@jkowalleck jkowalleck added the bug Something isn't working label Oct 1, 2024
@jkowalleck jkowalleck changed the title Fix: Mark devDependencies as "excluded" in SBOM generation fix: mark devDependencies as "excluded" in SBOM results Oct 1, 2024
// }

// Initialize component with a default value
let component: Models.Component | undefined = undefined;
Copy link
Member

@jkowalleck jkowalleck Oct 1, 2024

Choose a reason for hiding this comment

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

this new variable, it is assigned but never read.
so it is useless all along.
please remove this unused variable.

Copy link
Author

Choose a reason for hiding this comment

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

I have to assign the component variable a default value as undefined and then can mark it excluded in necessary place

Copy link
Member

@jkowalleck jkowalleck Oct 1, 2024

Choose a reason for hiding this comment

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

did you generate the test results and check if your changes have any effect?
please see https://github.com/CycloneDX/cyclonedx-node-npm/blob/main/CONTRIBUTING.md

@ARRY7686
Copy link
Author

ARRY7686 commented Oct 1, 2024

made the requested changes kindly check

@jkowalleck jkowalleck marked this pull request as draft October 1, 2024 17:01
* branch set_devdependencies_to_excluded -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
Copy link
Member

Choose a reason for hiding this comment

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

what is this supposed to be?!

@jkowalleck
Copy link
Member

@ARRY7686 something completely messed up.
please fix your code, run the tests, re-build the test results/snapshots and showcase that your changes have any effect.

@ARRY7686
Copy link
Author

ARRY7686 commented Oct 1, 2024

I am closing this PR and making a new one with fresh changes

@ARRY7686 ARRY7686 closed this Oct 1, 2024
@jkowalleck
Copy link
Member

Superseded by #1222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: set devDependencies component.scope to excluded
2 participants