Repository navigation
Fixed handling of origin when allow_credentials enabled - #985
Merged
Merged
Conversation
TiARETiK
marked this pull request as draft
January 16, 2025 10:33
TiARETiK
force-pushed
the
origin-handling-fix
branch
4 times, most recently
from
January 16, 2025 14:01
7d12d5e to
f333d40
Compare
TiARETiK
force-pushed
the
origin-handling-fix
branch
from
January 16, 2025 14:47
f333d40 to
aa79927
Compare
TiARETiK
marked this pull request as ready for review
January 16, 2025 14:50
gittiver
reviewed
Jan 24, 2025
Contributor
Author
|
@gittiver is the current state of the pull request acceptable, or shall I do something more for it to be accepted? |
gittiver
approved these changes
Feb 7, 2025
Member
|
I simply overlooked the review, sorry. |
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.
There are two things to start with:
Originheader.Access-Control-Allow-Credentialsheaders.Access-Control-Allow-Credentials=trueandAccess-Control-Allow-Origin=*. (source)Currently, the master branch's response to OPTIONS request contains an
Access-Control-Allow-Origin=, which is interpreted incorrectly by most browsers. We can't fix it by simply checking for the presence of anOriginheader in the request, due to the possibility of sending out bothAccess-Control-Allow-Credentials=trueandAccess-Control-Allow-Origin=*. The simple yet correct way to fix that behavior is to specifically check that the request being answered is not anOPTIONSone. Such a check is implemented in this pull request. There is also a test added that checks for incorrectOrigins-Credentialsbehavior.