Add webauthn verification page #3310
Merged
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.
What problem are you solving?
Part of #3298, which adds WebAuthn verification support to the CLI.
This follows up on #3305, which added the ability to generate a path token and send the verification URL containing that token in the API. Now, we replace the stubbed out
example.com
host for the token by creating the actual verification page that that URL leads to. We leave the work of actually doing the authentication dance to a future PR.What approach did you choose and why?
The verification url is only valid when given a valid, non-expired token, and it sets the user that you're authenticating as as the user for whom the token is for.
Valid Token:

Invalid Token:

What should reviewers focus on?
The 404 for invalid tokens is the same approach NPM takes, though they do add an error message to their 404 page that says "Invalid or expired token. Please try again." I considered adding that error here, however our 404 pages are completely static right now and don't take any dynamic content or flash messages. I ultimately decided that a 404 was clear enough without the message and the most idiomatic status. (After all, when you go to
rubygems.org/gems/invalid_gem_name
we don't give you an error explaining that the gem couldn't be found because the gem name is invalid. Its implied in the 404. Why would this be any different?) But I'm open to different opinions.