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

purl of scoped packages #56

Closed
scolytus opened this issue May 7, 2020 · 6 comments
Closed

purl of scoped packages #56

scolytus opened this issue May 7, 2020 · 6 comments

Comments

@scolytus
Copy link

scolytus commented May 7, 2020

I'm trying to get my head around scoped packages in npm.
Maybe I'm wrong and overlooked something, please have a look.

Purl Spec

According to purl-spec for npm packages scoped packages shall use the package's scope as purl namespace. Example from spec

pkg:npm/%40angular/animation@12.3.1
  • type: npm
  • namespace: @angular encoded as %40angular
  • name: animation
  • version: 12.3.1

Problem

However, when I use cyclonedx-bom -d -o bom.xml I get in the generated BOM URLs like this:

<purl>pkg:npm/angular/%40angular%2Fanimations@9.1.4</purl>
  • type: npm ✔️
  • namespace: angular, not encoded because no @ in there
    • ❌ should be @angular
  • name: @angular/animation, encoded as %40angular%2Fanimations
    • ❌ should be animation
  • version: 9.1.4 ✔️

Version

$ cyclonedx-bom --version
1.1.3
@scolytus
Copy link
Author

scolytus commented May 7, 2020

FYI: Dependency Track relies on this format pkg:npm/angular/%40angular%2Fanimations@9.1.4 and does not work with pkg:npm/%40angular/animation@12.3.1.

@stevespringett
Copy link
Member

It should be producing scoped packages in the following format: pkg:npm/%40angular/animations@9.1.4. If it doesn't, then that is certainly a defect.

@scolytus
Copy link
Author

scolytus commented May 7, 2020

@stevespringett on my machine it's reproducible, see for example:
https://github.com/scolytus/dependency-demo/blob/master/boms/angular20200506.bom.xml

I also checked the implementation in Dependency Track, it also relies on this faulty behavior for scoped packages, it does not use purl.namespace at all for npm analysis.
Shall I open an issue there as well?

And just for completeness, OSS Index understands neither version, see OSSIndex/vulns#91

@stevespringett
Copy link
Member

Thank you.

I also checked the implementation in Dependency Track, it also relies on this faulty behavior for scoped packages, it does not use purl.namespace at all for npm analysis.
Shall I open an issue there as well?

Yes please

@stevespringett
Copy link
Member

This fix will be included in the upcoming 2.0.0 release.

@stevespringett
Copy link
Member

2.0.0 was pushed to npm. closing.

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

No branches or pull requests

2 participants