-
Notifications
You must be signed in to change notification settings - Fork 667
Add DISABLE_TOKEN_CREATION
flag
#11894
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
Conversation
Setting this environment variable will cause crates.io to reject new API token creation requests with the error message set inside the environment variable. This can be useful to e.g. temporarily pause API token creation during ongoing phishing campaigns.
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.
Nice tests! It'd probably be friendlier to users to hide the new token form as well, but this will do for a first impl.
Can we add logging during the disablement period, to explicitly capture all attempts to create a token during the disabled period? |
|
src/controllers/token.rs
Outdated
warn!( | ||
"Blocked token creation for user `{}` (id: {}) due to disabled flag (token name: `{}`)", | ||
user.gh_login, user.id, new.api_token.name | ||
); |
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.
@walterhpearce isn't that what we're doing here? 😅
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.
I missed it because I am not smart. Can we log the full request during this period? Headers + addresses.
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.
I've added the IP address and the headers, minus cookie and authorization header to not unnecessarily expose these in our logs.
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
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.
Setting this environment variable will cause crates.io to reject new API token creation requests with the error message set inside the environment variable. This can be useful to e.g. temporarily pause API token creation during ongoing phishing campaigns.
Resolves #11892