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

Incorrect parsing for PURLs without names #131

Open
matt-phylum opened this issue Nov 8, 2023 · 2 comments
Open

Incorrect parsing for PURLs without names #131

matt-phylum opened this issue Nov 8, 2023 · 2 comments

Comments

@matt-phylum
Copy link

The PURL test suite contains an invalid PURL pkg:swift/github.com/Alamofire/@5.4.3 which is supposed to fail parsing because it has no name. packageurl-python parses the PURL as having namespace github.com and name Alamofire.

@tdruez
Copy link
Collaborator

tdruez commented Dec 8, 2023

@matt-phylum I'm not sure what you mean by "is supposed to fail parsing because it has no name".

The purl seems a bit wrongly formatted because of the extra / between name and version but it matches the purl spec: scheme:type/namespace/name@version

The behavior of packageurl-python on this purl seems fine:

>>> from packageurl import PackageURL

>>> PackageURL.from_string("pkg:swift/github.com/Alamofire/@5.4.3")
PackageURL(type='swift', namespace='github.com', name='Alamofire', version='5.4.3', qualifiers={}, subpath=None)

>>> PackageURL.from_string("pkg:swift/github.com/Alamofire/@5.4.3").to_string()
'pkg:swift/github.com/[email protected]'

@matt-phylum
Copy link
Author

The PURL test suite says that packageurl-python is supposed to fail parsing this malformed PURL. Alamofire is incorrectly being parsed as the name when it's part of the namespace. PURLs that are interpreted differently across implementations cause interoperability issues.

https://github.com/package-url/purl-spec/blob/f729aec79e3e13ac709d6675788634e53fe4d571/test-suite-data.json#L422-L433

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