Conversation
This was referenced May 14, 2026
This was referenced Jun 23, 2026
This was referenced Jul 5, 2026
This was referenced Jul 23, 2026
This was referenced Aug 1, 2026
kilisamemarisaaa
left a comment
There was a problem hiding this comment.
The new origin test is too weak to prove the proposed behavior. It only asserts that Access-Control-Allow-Origin is not '*'; an implementation that omits the header entirely would pass that assertion even though a credentialed CORS request with Origin: http://example.com should receive the reflected origin (and Vary: Origin).
Please assert the concrete contract, for example:
assert.equal(res.getHeader('Access-Control-Allow-Origin'), req.headers.origin)
assert.equal(res.getHeader('Vary'), 'Origin')A separate request without an Origin header can cover the intentional no-header case. The methods/headers/exposed-header tests should likewise assert the complete header set rather than only notEqual('*').
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.
Description
This PR addresses issue #333 by ensuring that the
*wildcard is not used inAccess-Control-Allow-Origin,Access-Control-Allow-Methods,Access-Control-Allow-Headers, orAccess-Control-Expose-Headersresponse headers whenAccess-Control-Allow-Credentialsis set totrue, as required by the Fetch Standard.Changes
origin: '*'(default) is set andcredentials: true, the middleware now reflects theOriginrequest header and addsVary: Origin.methods: '*'is explicitly set andcredentials: true, theAccess-Control-Allow-Methodsheader is omitted from the response.allowedHeaders: '*'is explicitly set andcredentials: true, theAccess-Control-Allow-Headersheader is omitted from the response.exposedHeaders: '*'is explicitly set andcredentials: true, theAccess-Control-Expose-Headersheader is omitted from the response.Verification