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

Feature/fix misparsed tokens #467

Merged
merged 2 commits into from Oct 12, 2021
Merged

Conversation

fluffy-critter
Copy link
Collaborator

@fluffy-critter fluffy-critter commented Oct 12, 2021

Summary

Fixes exception recursion error when handling a bad Authorization header; fixes #466

Detailed description

When a token failed due to malformed/expired token or malformed header, this would result in an error page. But the error handler was also trying to get the active user, which in turn was trying to parse the bad header. This led to an overall failure.

The fix was to make use of the already-existing token_error field on the context which informs us that the token already failed to parse, and to make user.get_active() return None.

Developer/user impact

Test plan

Manually tested with invalid, expired, malformed, and valid tokens via curl -H.

Got a site to show off?

@fluffy-critter fluffy-critter merged commit eb88b58 into main Oct 12, 2021
@fluffy-critter
Copy link
Collaborator Author

I have really got to start unit testing this stuff

@fluffy-critter fluffy-critter deleted the feature/fix-misparsed-tokens branch October 12, 2021 01:44
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.

Bearer token parse results in 500 instead of 401
1 participant