Skip to content

[Bug]: Hash state VS local state validation does not work when using special characters #2089

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

Open
Salketer opened this issue Mar 31, 2025 · 4 comments

Comments

@Salketer
Copy link

Version

18.0.2

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

[DEBUG] google - ValidateStateFromHashCallback failed, state: d%7C1 local_state:d|1

Steps to reproduce the behavior

use setState("anything|with specialchar");
login using provider.

A clear and concise description of what you expected to happen.

When reading the state from the querystring, it is URI encoded and directly compared to the original value. It should be decoded before comparing.

Additional context

No response

@FabianGosebrink
Copy link
Collaborator

FabianGosebrink commented Apr 2, 2025

Thanks for that bug. Which lines are you referring to?

@Salketer
Copy link
Author

Salketer commented Apr 2, 2025

Hello Fabian, I wasn't referring to any line of code as I did not check the source. The error message was enough to hint at what was happening. I'll try to dig deeper later today if you want.

@FabianGosebrink
Copy link
Collaborator

Ah, out of your message I though you might have analyzed the code already :D Sorry, I was wrong then. I will also have a look later. Help would be appreciated. Thanks!

@Salketer
Copy link
Author

Salketer commented Apr 3, 2025

No worries,

So I found where it's coming from:

Here the test is executed. I followed the trail up to where callbackContext.authResult?.state is defined and it seems to be from

Weird thing is that it looks like the parameters are correctly sanitized...

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

2 participants