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 encoding for SwiftPM is invalid as PURL specification. #8567

Open
heliocastro opened this issue Apr 25, 2024 · 1 comment
Open

PURL encoding for SwiftPM is invalid as PURL specification. #8567

heliocastro opened this issue Apr 25, 2024 · 1 comment
Assignees
Labels
bug Issues that are considered to be bugs

Comments

@heliocastro
Copy link
Contributor

Current Swift generated PURL has slash encoding, creating a result similar like:

purl: "pkg:swift/github.com%2Fapple%2Fswift-argument-parser@1.3.0"

This is not valid following the PURL specification. Quoting here from Character Encoding section:

the '/' used as type/namespace/name and subpath segments separator does not need to and must NOT be percent-encoded. It is unambiguous unencoded everywhere

This issue was first discussed with @pombredanne and this is really invalid.

On last community meeting, @fviernau mentioned a probable cause that SwiftPM not provides the namespace like field, only entire namespace as a name, and Ort was assuming that slash was a part of name, so %2F enconding.
Some package manager like Maven provides namespace ( a Java common ), so Ort probably wrong assuming that every single package manager follow.

A possible simple solution is just not encode anymore ant entry and treat PURL as single entity, instead of expecting namespace ( or consider as last fallback )

A more complex, un unlikely solution is make adjusts on the SwiftPM package manager code to separate namespace / name, but this can only work if retrieved names are consistent from the package manager.

A possible improvement is get rid of self made PURL code and use the PURL official java library to assembly the PURL and have it validated as well.

@heliocastro heliocastro added the bug Issues that are considered to be bugs label Apr 25, 2024
@heliocastro heliocastro self-assigned this Apr 25, 2024
@fviernau
Copy link
Member

fviernau commented Apr 25, 2024

In order to interpret the excerpt from the PURL spec, one must have define what exactly the namespace and name bits are. This IMO is not clear for swift packages.

Maybe, this discussion is interesting as well: google/osv.dev#1923

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that are considered to be bugs
Projects
None yet
Development

No branches or pull requests

2 participants