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

Ensure state is decoded before it is processed #1456

Merged
merged 3 commits into from Apr 7, 2020
Merged

Conversation

jasonnutter
Copy link
Contributor

@jasonnutter jasonnutter commented Apr 3, 2020

The library will encode the state value, and in the scenario were there is an error, it appears that the service will encode the state parameter again when it is sent back to the library. This means the library will need to decode it twice before it is in the right format to be parsed. Ensure that the deserialize function decodes twice, and that the parseLibraryState also decodes just in case.

Copy link
Member

@sameerag sameerag left a comment

Choose a reason for hiding this comment

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

LGTM. Was this identified in Unit tests?

@coveralls
Copy link

coveralls commented Apr 3, 2020

Coverage Status

Coverage remained the same at 77.094% when pulling a6a045e on decode-library-state into 8e54098 on dev.

@jasonnutter
Copy link
Contributor Author

Was able to properly root cause this: we encode the state value on the way out the door, and it appears the service encodes it again when sending back to us. This results in a double encoded state value, so I updated the deserialize function to decode twice to make sure things are in the right format. Added tests.

Copy link
Contributor

@jmckennon jmckennon left a comment

Choose a reason for hiding this comment

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

LGTM

@jasonnutter
Copy link
Contributor Author

jasonnutter commented Apr 6, 2020

Hmm I seem to be having trouble reproducing this behavior now, maybe it was fixed server side.

Remember now, this happens specifically with error responses.

@jasonnutter jasonnutter merged commit 572a213 into dev Apr 7, 2020
@jasonnutter jasonnutter added this to the msal@1.3.0 - Release milestone Apr 23, 2020
@tnorling tnorling deleted the decode-library-state branch October 6, 2021 23:37
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

6 participants