Skip to content

Conditionally resolve bearer token from request parameters #10340

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

Merged
merged 1 commit into from
Oct 13, 2021

Conversation

pneuschwander
Copy link
Contributor

@pneuschwander pneuschwander commented Oct 4, 2021

What this pull request changes

Before this commit, the DefaultBearerTokenResolver unconditionally
resolved the request parameters to check whether multiple tokens
are present in the request and reject those requests as invalid.

This commit changes this behaviour to resolve the request parameters
only if parameter token is supported for the specific request
according to spec (RFC 6750).

Why this change is proposed

gh-10326 describes the impact of resolving the request parameters for large requests.
Resolving the request parameters conditionally as proposed by this pull request should solve the issue.

Notes

As this is my first contribution, please double check and feel free to provide feedback.

Closes gh-10326

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 4, 2021
@pneuschwander pneuschwander marked this pull request as ready for review October 4, 2021 17:12
@sjohnr sjohnr self-assigned this Oct 4, 2021
@sjohnr sjohnr added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 4, 2021
Copy link
Member

@sjohnr sjohnr left a comment

Choose a reason for hiding this comment

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

Greetings, @pneuschwander! Great start to this PR, thanks for working on it!

I was thinking I wouldn't have too many comments, but because of the number of tests (wonderful problem to have), I found a few extra things for you to think about. Sorry about the flood of comments! (It's not an indication that there's anything wrong.) See below comments inline, including a fairly lengthy discussion on a suggestion I have.

Lastly, would you mind adding // gh-10326 above each new unit test that is added in this PR?

Thanks!

@pneuschwander
Copy link
Contributor Author

@sjohnr Thank you for your feedback. I modified the PR accordingly. Could you please review the changes and let me know whether there is more that should be done before we can merge? 🙂

@pneuschwander pneuschwander requested a review from sjohnr October 10, 2021 16:32
Copy link
Member

@sjohnr sjohnr left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, @pneuschwander. I have one additional comment below for discussion.

Before this commit, the DefaultBearerTokenResolver unconditionally
resolved the request parameters to check whether multiple tokens
are present in the request and reject those requests as invalid.

This commit changes this behaviour to resolve the request parameters
only if parameter token is supported for the specific request
according to spec (RFC 6750).

Closes spring-projectsgh-10326
@pneuschwander pneuschwander requested a review from sjohnr October 12, 2021 18:13
@sjohnr sjohnr added the type: breaks-passivity A change that breaks passivity with the previous release label Oct 13, 2021
@sjohnr sjohnr added this to the 5.6.0-RC1 milestone Oct 13, 2021
@sjohnr sjohnr merged commit 6db58cb into spring-projects:main Oct 13, 2021
@sjohnr
Copy link
Member

sjohnr commented Oct 13, 2021

Thanks @pneuschwander, this is now in main. Also, congrats on your first contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue type: breaks-passivity A change that breaks passivity with the previous release type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DefaultBearerTokenResolver triggers processing of multipart content
3 participants