[SDK-2943] Add check for state in handleRedirectCallback #841
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This PR re-adds the check for a matching
state
value when handling the callback from Auth0. We used to perform this check differently, as the transaction key used to contain the state value (so getting the transaction implictly meant that the state would have to match). However, this check was removed when we removed the state from the transaction key.As this SDK enforces PKCE which already enables sufficient CSRF protection, this state check is not necessary to perform. However, we do continue to send a
state
param to the IdP and the specification states that the state must be validated if one is sent to the/authorize
endpoint (see sections 4.1.2 and 10.12 of RFC6749).Rather than remove sending the
state
value, we've chosen to re-add the check, which should present no issues to customers, but does provide better optics than just removing state.References
SDK-2943
(internal ticket)Testing
Checklist