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

fix type hint for CSRFProtectMiddleware #17

Merged
merged 1 commit into from
Apr 9, 2024

Commits on Apr 7, 2024

  1. fix type hint for CSRFProtectMiddleware

    Parameter `csrf_secret` of class `CSRFProtectMiddleware` should be of type `Optional[str]` instead of `Optional[ByteString]` as `generate_csrf` and `validate_csrf` take in `csrf_secret` as `str`.
    Passing a `ByteString` as `csrf_secret` to `CSRFProtectMiddleware` cause token validation to raise `BadSignature` exception, and `validate_csrf` to raise `ValidationError('The CSRF token is invalid.')`.
    letuanhai committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    b03a831 View commit details
    Browse the repository at this point in the history