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

Create short redirect link format for vulnerabilities. #952

Merged
merged 4 commits into from
Jan 9, 2023

Conversation

oliverchang
Copy link
Collaborator

https://osv.dev/VULN-ID would redirect to
https://osv.dev/vulnerability/VULN-ID, if VULN-ID exists.

Fixes #930.

_VALID_BLOG_NAME = re.compile(r'^[\w-]+$')
_WORD_CHARACTERS_OR_DASH = re.compile(r'^[\w-]+$')
_VALID_BLOG_NAME = _WORD_CHARACTERS_OR_DASH
_VALID_VULN_ID = _WORD_CHARACTERS_OR_DASH
Copy link
Contributor

Choose a reason for hiding this comment

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

You could tighten this regex up a bit more to say ^\w+-[\w-]+$ and be less likely to match on things that aren't actually intended to be vulnerability IDs now, or in the future...

(aside: I can't find any signs of LBSEC IDs, even though they get a mention in the schema docs)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, but it does add a tad bit more complexity (adding a similar but different regex) for little benefit (since we ultimately validate the ID to exist in our DB), and this is a rare edge case that would save us a single Datastore entity read.

I'll keep this as is in the interests of simplicity.

@oliverchang oliverchang enabled auto-merge (squash) January 8, 2023 23:53
@oliverchang oliverchang merged commit b8f3e6e into master Jan 9, 2023
@oliverchang oliverchang deleted the short-link-redirector branch January 9, 2023 00:21
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

Successfully merging this pull request may close these issues.

Create shorter redirect link format for vulnerabilities
3 participants