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

KeyError in AuthView #23

Open
xi opened this issue Oct 3, 2024 · 0 comments
Open

KeyError in AuthView #23

xi opened this issue Oct 3, 2024 · 0 comments

Comments

@xi
Copy link
Owner

xi commented Oct 3, 2024

I sometimes see KeyErrors on the line del self.request.session['mfa_user'] in MFAAuthView.form_valid(). This is unexpected because MFAAuthView.user is used immediately before that, and it also uses self.request.session['mfa_user']. So if that key would not exist, this should show up earlier, not in this line.

The only way I can explain this issue is if there is a race condition between two requests. They could both pass the earlier uses of this data, then one removes it from the session and the other raises an issue.

On the other hand, the application where I saw these errors uses javascript from double-cklicking submit buttons. So accidentally triggering this race condition is extremely unlikely.

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

No branches or pull requests

1 participant