-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Conversation
There was a problem hiding this 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?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Remember now, this happens specifically with error responses. |
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.