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

Sanitizing token. #143

Closed
wants to merge 1 commit into from
Closed

Sanitizing token. #143

wants to merge 1 commit into from

Conversation

AlvaroAguilera
Copy link

Description of the Pull Request (PR):

Small token sanitation line to fix the issue with participants copying tokens with added zero-width spaces.

This fixes or addresses the following GitHub issues:

Checkoff for all PRs:

Attn: @AlvaroAguilera

@@ -62,7 +62,7 @@ def login_get():
if not subid:
token = request.args.get("token")
if token:

token = form.token.data.encode('ascii', errors = 'ignore').decode().strip()
Copy link
Member

Choose a reason for hiding this comment

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

This isn't technically correct - note that above we are getting the token from request.args, and then below you are again getting it (but this time from form data). I think you would just want to apply that encode to the token you've already gotten. Also look below here to see there are two cases where we retrieve the token, one from the request and one from form data, and you should test if you need to encode both.

Copy link
Author

Choose a reason for hiding this comment

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

How about putting the line inside the function validate_token()?

Copy link
Member

Choose a reason for hiding this comment

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

There are actual multiple instances of that function, I think 3 or 4 places to add it, vs. adding to the original grab of the token (N=2). So I'm thinking we want it after retrieving the argument.

Copy link
Member

Choose a reason for hiding this comment

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

You need to keep the same methods to retrieve the token (request.args.get) and then in the "if token" statement further do token = token.encode...

@vsoch
Copy link
Member

vsoch commented Sep 27, 2022

@AlvaroAguilera I had requested some changes here - any updates?

@AlvaroAguilera
Copy link
Author

I'm in debt, I know. Hope to find time for this soon.

@AlvaroAguilera AlvaroAguilera closed this by deleting the head repository Oct 19, 2022
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

2 participants