-
Notifications
You must be signed in to change notification settings - Fork 65
Add TokenHash and Label to AuthToken, allow revoke by hash #492
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
Add TokenHash and Label to AuthToken, allow revoke by hash #492
Conversation
|
@neelvirdy can the label address this requirement #471 ? |
64c4c49 to
b633f3b
Compare
@en0ma yep! didn't see that issue till now but it seems identical except these 2 differences:
|
8eb200e to
e229a07
Compare
If this is done, I think it will completely address that issue. I am ok with using "label" too. |
|
@alvin-reyes can you have a look at this PR |
alvin-reyes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @neelvirdy!
Can you add some verification tests and post it in this PR? Just add a new section on the description part
## Verification
### revoke user by hash
<screen shot of the UI or the cli>
### revoke user by key
<screen shot of the UI or the cli>
alvin-reyes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Implements Phase 1/4 of #343, which tracks the switch to only store hashes of API Tokens in DB.
The end-user experiences no change in behavior from this PR, but newly created tokens will have a TokenHash and Label stored in DB. The Label is an arbitrary string that does not need to be unique, but allows the user to track the keys that are in use and know which to revoke when needed.
Allowing revoke by hash is necessary to ensure keys can still be revoked after we stop storing the raw token itself.
For info on follow-up PRs to complete the switch, see the issue linked above.
Demonstrating creating a new key with a label, as well as revoking keys by hash and by key. The listed tokens with the censored token are the keys that have no token value stored in the db, and are being revoked via their hash.
Screen.Recording.2022-11-07.at.12.08.59.PM.mov