-
Notifications
You must be signed in to change notification settings - Fork 6k
Validate token passed in query parameters same as headers #7012
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
Conversation
I've made the assumption that the query parameters here have already been decoded and therefore can be validated against a pattern. If this is not true then just checking for empty query parameter will also resolve the issue. |
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.
Thanks, @bhavikkumar, for the PR! I've left some feedback inline.
...java/org/springframework/security/oauth2/server/resource/web/DefaultBearerTokenResolver.java
Outdated
Show resolved
Hide resolved
...ork/security/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverter.java
Outdated
Show resolved
Hide resolved
Also, @bhavikkumar, would you please format your commit message like this, including at least the phrase "Fixes: gh-7011"? |
2713651
to
a7eb0d2
Compare
@bhavikkumar, in taking another look at this PR and matching it against the RFC, I think there's a mismatch since the RFC doesn't specify a format for bearer token query parameters. I think it would be better to stick to the RFC, and, in fact, #7020 aligns with this on the reactive side. So, to better align with the RFC and also the reactive solution of #7011, would you please update your PR to complain when the query parameter is empty (not if it doesn't follow the same pattern as a bearer token header value)? |
I just wrote a quick test around this for the non reactive flow, it seems to work as expected. Closing this PR. |
@bhavikkumar, sorry, I'm confused. #7020 only addresses the reactive stack. I think your PR is still necessary for the servlet stack? |
I had not verified the servlet stack, but based on the code it looked like it needed the same fix. However, when I implemented it to check, it worked fine without the fix. I received the expected 401 response. I didn't follow it through to where it was being handled. I can push up the example if you want to verify. |
I see, @bhavikkumar, thank you. |
Validates access tokens passed through query parameters in the same manner as if they were passed in Authorization HTTP header as a bearer token.
This resolves #7011