-
Notifications
You must be signed in to change notification settings - Fork 2
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 the ability to mint new API tokens through the UI #330
Conversation
the "bad tokens" implementation is easy and with the help of a library like |
A user can only mint 5 tokens max is another great idea proposed by @khoroshevskyi |
Maybe a combination of everything would be sufficient to deter anyone from being mean and crashing pephub :) |
Ok -- I have implemented:
I suppose yet another option we could employ is periodically purging the "bad jwts" list and checking for expired keys (they can be removed since they will be rejected anyways on the basis that they are expired). |
Last thing: clean up the dev modal |
@khoroshevskyi this is ready for review. Only thing that I haven't tested is deleting all PEPs -- I am afraid too since i have a couple I want to keep 😃 It should work though.... |
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.
Some changes needed,
but works really good
This PR adds the ability for users to create new API tokens on the fly for yourself through the PEPhub user interface. This is just a little easier than using a
cli
to do the same thing.Directly addresses: #313
Features
Caveats
The revoking problem
Revoking a token doesn't invalidate it! Because the JWT is a self-contained entity, revoking it does nothing. As long as it was minted with the appropriate secret, it is valid!
A potential workaround is to keep a list of "bad"/"revoked" JWTs and check these on the server when the authorization header is parsed for authorized requests:
A downside to this is it sets the stage for a nefarious actor to pollute the "bad tokens" in-memory store by continuously minting and revoking tokens until memory runs out. This could be solved via rate limiting the minting of tokens.