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

Recovery code reporting & revocation #17301

Open
4 tasks
di opened this issue Dec 18, 2024 · 3 comments
Open
4 tasks

Recovery code reporting & revocation #17301

di opened this issue Dec 18, 2024 · 3 comments
Labels
2FA feature request security Security-related issues and pull requests

Comments

@di
Copy link
Member

di commented Dec 18, 2024

What's the problem this feature will solve?
Currently, we don't support disclosure for our 2FA Recovery codes, nor do we support manual revocation by admins.

Describe the solution you'd like

  • Admins can manually revoke leaked recovery codes
  • Recovery codes have a recognizable pattern
  • Recovery codes can be revoked automatically via our secret-reporting API
  • Our existing secret-scanning partners support automated reporting of recovery codes

Additional context
Currently, recovery codes have the following format:

r"^[0-9a-fA-F]{16}$"

This is the result of calling secrets.token_hex(8). This is probably too generic for most secret scanning partners as it will likely result in a large number of false positives.

Ideally recovery codes would have a shared prefix like pypi- which our API tokens use, but we should be careful not to make these codes easily confusable with API tokens.

@di di added feature request security Security-related issues and pull requests tokens Issues relating to API tokens labels Dec 18, 2024
@di
Copy link
Member Author

di commented Dec 18, 2024

Also, this should go without saying, but if we do change the recovery code pattern, we should maintain backwards compatibility with the existing recovery code pattern, just stop generating new codes with it.

@miketheman miketheman added 2FA and removed tokens Issues relating to API tokens labels Dec 18, 2024
@miketheman
Copy link
Member

Re: Admins can manually revoke leaked recovery codes

We currently have the ability in Admin UI to wipe recovery codes + 2FA - would that be sufficient to handle this use case?

@di
Copy link
Member Author

di commented Jan 8, 2025

The question is whether we know which user owns the recovery codes or not. Since codes are stored as salted hashes in our database, I think we can't actually do the 2nd, 3rd and 4th items here if we are just given a "bare" code.

If we know the user though, a button to wipe the recovery codes is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2FA feature request security Security-related issues and pull requests
Projects
None yet
Development

No branches or pull requests

2 participants