-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support 303 status for authorization response #1051
Comments
@wapkch The article you referenced is dated 2016 so it's quite old and OAuth2 has gone through many revisions since.
Can you please provide more details on your reasoning? Do you see issues with the current implementation of |
In my scenario, no issue so far. And probably not a problem for most modern browsers. But i'm afraid some user-agents treat 302 like 307 which then would expose the user's credentials to the OAuth2 client on the callback. So, 303 is the best choice. Or at least, provide an easy way to replace the |
@wapkch I wasn't able to reproduce the issue. Your request sequence is different than the default Messages sample as it appears you are not using OIDC for authentication. Can you please provide a minimal sample that reproduces the issue so I can replicate on my end. |
Hi @jgrandja, In the above scenario, I was assuming a user-agent which treats 302 like 307(Not encountered so far, but it is possible). So i changed the
|
@wapkch Thanks for providing the sample. The customization applied in Furthermore, I don't see this being an issue with Spring Security either. The
It appears you haven't found a user-agent that actually performs this behaviour. However, if you did, this is a bug in the user-agent and should be reported to their ticketing system. Also, consider a similar use case where Based on the explanation provided, I'm going to close this as I don't see any issues in Spring Authorization Server or Spring Security. |
Hi @jgrandja Thanks for your detailed reply. I agree that it's the authentication mechanism in Spring Security triggers the issue, and it's not specific to OAuth. But i think there are still optimizations we can do:
I'm not sure if this is a bug in the user-agent. Because according to rfc2616:
Some user-agents erroneously redirect a 302 POST into a GET request, so 303 and 307 was added to make it clear. And later in rfc7231:
There is no clear instructions that 302 can not be used to redirect a POST into a POST. But 303 can do that:
So, changing the status from 302 to 303 for authorization response can avoid the risks. Do you agree with that? Even without modifying the default behavior, do you think adding a setter method for
|
Yes. But we'll have to figure out an improvement that won't break existing applications.
I don't think I want to expose I'll re-open this and we can consider what the best option would be. |
Expected Behavior
According to A comprehensive formal security analysis of OAuth 2.0. 303 redirect should be used to drop the body of an HTTP POST request.
Current Behavior
DefaultRedirectStrategy in OAuth2AuthorizationEndpointFilter sets the status to 302
Context
If needed, i can work on it.
The text was updated successfully, but these errors were encountered: