Skip to content

Standardize password hashing and introduce configurable hashing for token revocation#967

Open
RinZ27 wants to merge 1 commit intojazzband:masterfrom
RinZ27:fix/configurable-hashing
Open

Standardize password hashing and introduce configurable hashing for token revocation#967
RinZ27 wants to merge 1 commit intojazzband:masterfrom
RinZ27:fix/configurable-hashing

Conversation

@RinZ27
Copy link

@RinZ27 RinZ27 commented Mar 3, 2026

Hardcoded MD5 hashing for password comparisons in REVOKE_TOKEN_CLAIM has been replaced with a more flexible mechanism. This update introduces a new setting, CHECK_REVOKE_TOKEN_HASH_ALGORITHM, which defaults to md5 to maintain strict backward compatibility for existing tokens. Users can now choose more modern algorithms like sha256 or sha512 by updating their project settings.

Refactoring the internal hashing utility to support multiple algorithms ensures that authentication and token validation remain robust while providing a clear path for modernization. The change impact is localized to:

  • settings.py: Added default hash configuration.
  • utils.py: Enhanced hashing utility with support for dynamic algorithms.
  • tokens.py, serializers.py, authentication.py: Integrated the configurable hashing logic into core workflows.

Existing tests in tests/test_authentication.py have been updated to reflect these changes, ensuring that the revocation check logic continues to function as expected under the new configurable model. This approach avoids breaking current installations while significantly improving the project's extensibility for different hashing standards.

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.

1 participant