Make CORS allow_credentials configurable instead of hardcoded True#62658
Open
Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Open
Make CORS allow_credentials configurable instead of hardcoded True#62658Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Conversation
Contributor
Author
Add [api] access_control_allow_credentials config option (default: False) to replace the hardcoded allow_credentials=True in CORSMiddleware. Also log a warning when credentials are enabled with wildcard origins, as this creates CSRF risk. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a67a3b9 to
c58535f
Compare
vincbeck
requested changes
Mar 2, 2026
Contributor
vincbeck
left a comment
There was a problem hiding this comment.
AI generated PR with no explanation on why doing this change. Plus, it introduces a breaking change. Please provide more details about this PR and why you want to make that change, otherwise I'll close it
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.
Summary
allow_credentials=Truein CORSMiddleware with configurable[api] access_control_allow_credentialsoption (default:False)allow_credentials=Trueis used with wildcard (*) origins, as this creates CSRF riskconfig.ymltemplateCo-contributors : @codingrealitylabs @girlcoder-gaming
Test plan
allow_credentials=Falsewhen option not setaccess_control_allow_credentials = Trueenables credentialspytest tests/api_fastapi/core_api/test_app.py -vNote: This is a breaking change for deployments that rely on CORS credentials being enabled by default.
🤖 Generated with Claude Code