docs: warn about dangerous origin:true + credentials:true combination - #424
Open
luisangelrod wants to merge 3 commits into
Open
docs: warn about dangerous origin:true + credentials:true combination#424luisangelrod wants to merge 3 commits into
luisangelrod wants to merge 3 commits into
Conversation
|
The warning is clear. One small addition that might prevent copy-paste mistakes is showing the dynamic allowlist shape, not only the static array case, since many apps need env-specific or tenant-specific origins. A short |
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
Adds targeted documentation warnings about the security risk of combining
origin: truewithcredentials: true, plus a dynamic environment-based allowlist example requested during review.When
originistrue, the package reflects the browser's origin intoAccess-Control-Allow-Origin. Combined withAccess-Control-Allow-Credentials: true, that can grant untrusted websites credentialed cross-origin access. The documentation now recommends an explicit allowlist and shows how to configure one without treating an unapproved origin as an application error.Changes
origin: trueoption to the credentials warning.ALLOWED_ORIGINSexample using the package's origin callback.callback(null, false)for unapproved origins so the response simply omits CORS headers.Validation
npm test— ESLint and 49 tests passed with 100% coveragegit diff --checkCloses #422