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

The CPAN urls with :: doesn't pass syntax check in Python lib #324

Closed
oej opened this issue Aug 27, 2024 · 4 comments · Fixed by #325
Closed

The CPAN urls with :: doesn't pass syntax check in Python lib #324

oej opened this issue Aug 27, 2024 · 4 comments · Fixed by #325
Labels
PURL type definition Non-core definitions that describe and standardize PURL types PURL validation

Comments

@oej
Copy link

oej commented Aug 27, 2024

The python lib fails to parse the CPAN URLs with two "::" in the name.

DEBUG: Not a valid PURL: pkg:cpan/LWP::UserAgent
ERROR: Invalid purl 'pkg:cpan/LWP::UserAgent' cannot contain a "user:pass@host:port" URL Authority component: ''.

Either the CPAN spec is wrong or the python library ;-)

@sjn
Copy link

sjn commented Aug 27, 2024

The CPAN spec is right – it has two way to specify dependency (just as other tooling used for interacting with CPAN does):

  1. Modules, which MAY contain :: as namespace delimiters, and MUST NOT contain a - in it's name
  2. Distributions, which MUST NOT contain :: in it's name, and which MAY contain - as namespace delimiters

I'd say it's the python library which doesn't follow the spec. 🐍

@matt-phylum
Copy link
Contributor

This test should be added to the test suite:

{
  "description": "valid cpan purl",
  "purl": "pkg:cpan/LWP%3A%3AUserAgent",
  "canonical_purl": "pkg:cpan/LWP::UserAgent",
  "type": "cpan",
  "namespace": null,
  "name": "LWP::UserAgent",
  "version": null,
  "qualifiers": null,
  "subpath": null,
  "is_invalid": false
}

The following implementations fail it:

  • anchore/packageurl-go, maennchen/purl: unnecessarily escaped name is incorrectly decoded
  • package-url/packageurl-go, package-url/packageurl-java, package-url/packageurl-js, package-url/packageurl-ruby: non-canonical formatting
  • package-url/packageurl-python: error while parsing canonical form

@giterlizzi
Copy link
Contributor

giterlizzi commented Aug 27, 2024

Hi, The #325 PR contains new proposed tests for CPAN.

@oej
Copy link
Author

oej commented Aug 28, 2024

Opened package-url/packageurl-python#165

@jkowalleck jkowalleck linked a pull request Oct 21, 2024 that will close this issue
@johnmhoran johnmhoran added PURL type definition Non-core definitions that describe and standardize PURL types PURL validation labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PURL type definition Non-core definitions that describe and standardize PURL types PURL validation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants