Skip to content

Add Package URL (PURL) display to crate sidebar #11416

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
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Jun 23, 2025

This PR adds Package URL (PURL) support to crate pages, enabling better integration with software supply chain and security tools. PURLs follow the format pkg:cargo/{name}@{version} and are displayed in the sidebar metadata section with click-to-copy functionality.

This is a frontend-only implementation that generates PURLs client-side using existing crate data. The display uses ellipsis overflow with a tooltip showing the full PURL.

On staging.crates.io (and everywhere that is no crates.io itself) it will append a repository_url qualifier (see package-url/purl-spec#215).

Bildschirmfoto 2025-06-23 um 21 05 07 Bildschirmfoto 2025-06-23 um 21 04 30

@Turbo87 Turbo87 requested a review from a team June 23, 2025 19:12
@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-frontend 🐹 labels Jun 23, 2025
Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

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

👍

One thought I do have is whether we should add some sort of help explaining what this is, since PURLs aren't a super well known concept right now. One thought: could we add a question mark on the right hand side of the PURL that has a hover explaining what a PURL is and why it's useful? Or maybe we have some other way of linking to more information. 🤷


// Add repository_url query parameter
const repositoryUrl = `https://${host}/`;
const separator = purl.includes('?') ? '&' : '?';
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels like this is redundant, since we can't ever generate a package URL that includes a ? right now?

(I guess, more broadly, I'm not quite clear on why this is separated from the basic PURL generation in the model.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not quite clear on why this is separated from the basic PURL generation in the model

I initially implemented the same property on the crate model too and wanted to DRY it up 😉

@Turbo87
Copy link
Member Author

Turbo87 commented Jun 24, 2025

I've added a small help icon next to the PURL now:

Bildschirmfoto 2025-06-24 um 09 28 35 Bildschirmfoto 2025-06-24 um 09 30 43

Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

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

Thanks for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
Status: For next meeting
Development

Successfully merging this pull request may close these issues.

2 participants