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

make state non-arbitrary #890

Merged
merged 2 commits into from
Apr 3, 2024
Merged

make state non-arbitrary #890

merged 2 commits into from
Apr 3, 2024

Conversation

terrazoon
Copy link
Contributor

@terrazoon terrazoon commented Apr 2, 2024

Description

Instead of using completely arbitrary values for 'nonce' and 'state' in the login.gov URL, let's use a scrambled version of the user's email address.

Security Considerations

There is also a bug fix in users_dao.py. We have changed from using the user's email address as our login.gov key to using the login.gov uuid. This is best practice. However, this leads to an edge case where the user perhaps changes their email in login.gov and we want to change it for them automatically in our app. In the real world, this should work fine. But in local testing, our app got confused which session it was running and this led to a sqlalchemy integrity error, which caused the user (me) to be locked out. So catch that error and log it, but allow the user to proceed.

Again we think right now this session confusion only occurs under abusive local developer testing where they use all their gsa email aliases on the same machine to register with login.gov and our app multiple times, but just in case.

@terrazoon terrazoon self-assigned this Apr 2, 2024
Copy link
Contributor

@xlorepdarkhelm xlorepdarkhelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Nice find.

Copy link
Contributor

@ccostino ccostino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @terrazoon!

@ccostino ccostino merged commit b73c087 into main Apr 3, 2024
5 checks passed
@ccostino ccostino deleted the login_gov_state branch April 3, 2024 21:04
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.

None yet

3 participants