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: return ecosyste.ms license based on package version #88

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

paulrosca-snyk
Copy link
Contributor

When enriching with ecosyste.ms, fetch the license based on the package version.

Closes #87

Comment on lines +56 to +59
// Ecosyste.ms has a purl based API, but unfortunately slower
// so we break the purl down to registry and name values locally
// params := packages.LookupPackageParams{Purl: &p}
// resp, err := client.LookupPackageWithResponse(context.Background(), &params)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we remove this? including the comment about the purl api? i don't find it particularly useful 😄

expression := data.NormalizedLicenses[0]
func enrichCDXLicense(comp *cdx.Component, data *packages.Version) {
if data.Licenses != nil {
if *data.Licenses != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this looks a bit like a red flag. don't we have data.NormalizedLicenses on the package version response? this change would mean that we are potentially enriching with unsanitized data. e.g. MIT,Apache-2.0 is not a valid SPDX license expression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like the ecosyste.ms response for a specific package version doesn't have a normalised licenses field, no

Copy link
Collaborator

Choose a reason for hiding this comment

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

I raised an issue with ecosyste.ms about this here: ecosyste-ms/packages#960

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

Successfully merging this pull request may close these issues.

Parlay doesn't seem to respect version number when determining license
2 participants