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

Mark components from test scope #505

Open
skhokhlov opened this issue May 28, 2024 · 7 comments
Open

Mark components from test scope #505

skhokhlov opened this issue May 28, 2024 · 7 comments

Comments

@skhokhlov
Copy link
Member

skhokhlov commented May 28, 2024

CycloneDX npm plugin adds properties for components in SBOM which are dev dependencies of the project.

"properties": [
        {
          "name": "cdx:npm:package:development",
          "value": "true"
        }
]

https://github.com/CycloneDX/cyclonedx-node-npm/blob/main/demo/dev-dependencies/example-results/bare/bom.1.6.json#L187-L188

This data is crucial for risk analysis of vulnerabilities. It would be perfect to add similar property to be able to identify test dependencies in SBOMs collected with maven plugin.

@FloJit
Copy link

FloJit commented Jul 24, 2024

It could be interesting to add the maven scope (not only test) in each component object.
I'll try to check it how to do that.

@FloJit
Copy link

FloJit commented Jul 24, 2024

Well, one way could be to add maven scopes in the Component.Scope enum and store the Artifact#getScope instead of to check the Artifact#isOptional.
But that means to modify the core ...

Or maybe one day change the type of the scope as String to let the possibility to set any scope of any plugin (I don't know how Gradle scopes work).

@jackhj000
Copy link

Well, one way could be to add maven scopes in the Component.Scope enum and store the Artifact#getScope instead of to check the Artifact#isOptional. But that means to modify the core ...

Or maybe one day change the type of the scope as String to let the possibility to set any scope of any plugin (I don't know how Gradle scopes work).

Hi,how about this feature now?

@ppkarwasz
Copy link
Contributor

Or maybe one day change the type of the scope as String to let the possibility to set any scope of any plugin (I don't know how Gradle scopes work).

Gradle has a configurable set of dependency configurations. Some are well-known, but users can always create custom ones.

Instead of adding all these scope/dependency configurations to the SBOM, it would be probable more useful to encode their meaning, so that non-Java developers can understand them better. It would be useful to explain:

  • When the dependencies are used (at compile-time, runtime or during tests). Runtime is of course the most important for dependents, but vulnerable compile-time dependencies can mess-up the build if they contain an annotation processor.
  • Whether the dependencies are inherited by dependents or not.

@hboutemy
Copy link
Contributor

Whether the dependencies are inherited by dependents or not.

when people start thinking like that, they are trying to use SBOMs as a way to replace build tools: SBOMs don't replace build tools

the key (and missing) aspect to store in SBOM is: is the dependency embedded or not?
and honestly, if not embedded, I'm not even sure it makes sense to store that data in SBOM, as it starts trying to replace build tools with SBOM

@ppkarwasz
Copy link
Contributor

the key (and missing) aspect to store in SBOM is: is the dependency embedded or not? and honestly, if not embedded, I'm not even sure it makes sense to store that data in SBOM, as it starts trying to replace build tools with SBOM

Yes, the problem on how to mark embedded dependencies is the principal problem to solve.

IMHO, for a Build SBOM the answer is easy: if it is not embedded, it shouldn't be there. For a Source SBOM, I honestly don't know what to expect. The content of such an SBOM should probably depend on how these SBOMs are used.

@hboutemy
Copy link
Contributor

IMHO, for a Build SBOM the answer is easy: if it is not embedded, it shouldn't be there

easy to say and easy to implement (just drop the vast majority of currently generated content)
but not easy to get a consensus on: if we implement that, community reaction will be at least strong surprise, not not say harsher than that

For a Source SBOM

we'll need to discuss what you call "source SBOM" and how it fits in the global picture

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

No branches or pull requests

5 participants