Conversation
Signed-off-by: William Woodruff <william@astral.sh>
Signed-off-by: William Woodruff <william@astral.sh>
Member
Author
|
Example render: |
woodruffw
commented
Mar 10, 2026
Comment on lines
+259
to
+276
| let link = vuln | ||
| .references | ||
| .as_ref() | ||
| .and_then(|references| { | ||
| references | ||
| .iter() | ||
| .find(|reference| matches!(reference.reference_type, ReferenceType::Advisory)) | ||
| .or_else(|| { | ||
| references.iter().find(|reference| { | ||
| matches!(reference.reference_type, ReferenceType::Web) | ||
| }) | ||
| }) | ||
| .map(|reference| reference.url.clone()) | ||
| }) | ||
| .unwrap_or_else(|| { | ||
| DisplaySafeUrl::parse(&format!("https://osv.dev/vulnerability/{}", vuln.id)) | ||
| .expect("impossible: synthesized URL is invalid") | ||
| }); |
Member
Author
There was a problem hiding this comment.
Flagging: IME this is a reasonable hierarchy/order of preference -- ADVISORY is semantically the "best" thing, whereas WEB usually refers to a detailed blog post or similar. If neither is present we fall back to the OSV URL itself for the vulnerability, which will include a render of all links of all types for the user to peruse.
(That said, we could drop the WEB fallback here to make things a bit shorter/terser.)
konstin
approved these changes
Mar 10, 2026
Signed-off-by: William Woodruff <william@astral.sh>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds links to
uv audit's outputs. This required adding links to the backing (common) Vulnerability type and pulling them from the OSV service. OSV will always produce a link for a Vulnerability (since the ID itself can be turned into a link), butVulnerability::linkitself is optional since other services may not necessarily guarantee this.Follows #18193.
Test Plan
None yet.