Skip to content

Extraction of package data from Bazel Metadata files is too strict #4196

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

Open
2 of 7 tasks
abraemer opened this issue Mar 18, 2025 · 0 comments · May be fixed by #4194
Open
2 of 7 tasks

Extraction of package data from Bazel Metadata files is too strict #4196

abraemer opened this issue Mar 18, 2025 · 0 comments · May be fixed by #4194

Comments

@abraemer
Copy link

Short Description

Currently in the package code, we check for one of two versions of .bzl files and convert them into PackageData slightly differently. There are 2 issues there:

  1. Currently, the check is broken making it much looser than intended
  2. If fixed, the check is too tight, because METADATA.bzl does not follow strict standards

I propose to remove the check altogether and always try to extract as much information from the file as possible.

Possible Labels

  • package formats
  • package scan
  • bug
  • easy

Select Category

  • Enhancement
  • Add License/Copyright
  • Scan Feature
  • Packaging
  • Documentation
  • Expand Support
  • Other

Describe the Update

I propose to combine the bodies of the if-statements, i.e. we simply check for the presence of the known fields in METADATA.bzl files and map them to their corresponding field in PackageData. This change also makes it easy to add further fields, if needed.
In fact, I'll also add support of a field package_url containing a PURL, which is widely used at my organization.

See #4194 for implementation.

How This Feature will help you/your organization

We use METADATA.bzl files for dependency management. When importing packages from Maven, the name usually contains a colon :, which means it is not suitable as name field of a PURL. This causes ScanCode to error when parsing our .bzl files. We do include a valid PURL which ScanCode does not recognize currently.

Can you help with this Feature

PR is already open: #4194

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

Successfully merging a pull request may close this issue.

1 participant