Fix OAuth2PushedAuthorizationRequestUri parsing#19445
Open
therepanic wants to merge 1 commit into
Open
Conversation
`OAuth2PushedAuthorizationRequestUri` uses Base64URL encoding for the state, which can produce a value containing `___`, the same sequence used as the delimiter. As a result, `indexOf` may locate a delimiter within the state instead of the delimiter preceding the expiration timestamp. Use `lastIndexOf` to reliably locate the delimiter before the timestamp without changing the existing request URI format. Closes spring-projectsgh-19444 Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
therepanic
marked this pull request as ready for review
July 14, 2026 16:29
therepanic
commented
Jul 14, 2026
Comment on lines
-60
to
61
| int expiresAtStartIndex = requestUri.indexOf(REQUEST_URI_DELIMITER) + REQUEST_URI_DELIMITER.length(); | ||
| int expiresAtStartIndex = requestUri.lastIndexOf(REQUEST_URI_DELIMITER) + REQUEST_URI_DELIMITER.length(); | ||
| String state = requestUri.substring(stateStartIndex); |
Contributor
Author
There was a problem hiding this comment.
It does not break backward compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
OAuth2PushedAuthorizationRequestUriuses Base64URL encoding for the state, which can produce a value containing___, the same sequence used as the delimiter. As a result,indexOfmay locate a delimiter within the state instead of the delimiter preceding the expiration timestamp.Use
lastIndexOfto reliably locate the delimiter before the timestamp without changing the existing request URI format.Closes gh-19444