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

Add support for upgrading API key hashes #213

Closed
wants to merge 1 commit into from

Conversation

florimondmanca
Copy link
Owner

@florimondmanca florimondmanca commented Jun 4, 2022

Found out while working on #173 (comment)

Currently, if PASSWORD_HASHERS changes and hasher A (eg. PBKDF2) previously used to hash API keys is moved lower in the list than another hasher B (eg. Argon2), then API key hashes won't be upgraded.

This PR adds support for this, by implementing verify(..., setter=...).


Needs some tests...

@codecov-commenter
Copy link

Codecov Report

Merging #213 (d9ad549) into master (6f76d19) will decrease coverage by 0.83%.
The diff coverage is 50.00%.

@@             Coverage Diff             @@
##            master     #213      +/-   ##
===========================================
- Coverage   100.00%   99.16%   -0.84%     
===========================================
  Files           24       24              
  Lines          595      602       +7     
===========================================
+ Hits           595      597       +2     
- Misses           0        5       +5     
Impacted Files Coverage Δ
src/rest_framework_api_key/crypto.py 90.00% <50.00%> (-10.00%) ⬇️
src/rest_framework_api_key/models.py 97.75% <50.00%> (-2.25%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@florimondmanca florimondmanca added this to the v2.3.0 milestone Jun 4, 2022
@florimondmanca florimondmanca removed this from the v2.3.0 milestone Aug 15, 2023
@florimondmanca
Copy link
Owner Author

Closing as this is irrevelant if we go with the DRF-api-key-specific SHA512 hasher as in #244.

@florimondmanca florimondmanca deleted the fm/hasher-setter branch September 11, 2023 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants