Repository navigation
CORS: clarify API documentation and remove conformance tests for credentialed requests - #4663
Conversation
…I reference Signed-off-by: Norwin Schnyder <norwin.schnyder+github@gmail.com>
Signed-off-by: Norwin Schnyder <norwin.schnyder+github@gmail.com>
@jub0bs: Could you possibly help verify our assumptions here? |
| // the `Access-Control-Expose-Headers` response header. | ||
| // If the configuration contains the wildcard `*` in `exposeHeaders` and | ||
| // `allowCredentials` is set to `true`, the gateway cannot use the `*` | ||
| // in the `Access-Control-Expose-Headers` response header. |
There was a problem hiding this comment.
Here I’m wondering what the purpose of allowing this configuration is:
- type: CORS
cors:
...
exposeHeaders:
- "*"
allowCredentials: true
If it effectively has the same semantics as when exposeHeaders is not specified at all.
There was a problem hiding this comment.
FWIW, I haven't seen any implementations that support exposing all response headers while also allowing credentialed access. It's technically difficult to do so.
There was a problem hiding this comment.
If it effectively has the same semantics as when exposeHeaders is not specified at all.
Well, the semantics intended in the GEP is for the proxy to read all the headers set by the server (or by the proxy itself) and list them in the Access-Control-Expose-Headers header. However, Envoy does not support that and jub0bs explains above that it's difficult to support.
I haven't tested it, but looking at the code it seems for the above configuration translated literally from Gateway API to Envoy config, Envoy will just set
Access-Control-Expose-Headers: *
Access-Control-Allow-Credentials: true
in response headers. With exposeHeaders not specified at all, the proxy/server response is at least valid according to standards. However, according to the playground, even for the above config the response body is shared with Javascript and only headers are concealed, so you are right that the semantics in Envoy seem the same.
Since we're not aware of any proxies supporting this in the way intended in the GEP (and we don't have conformance for that), perhaps we should forbid such a config in CEL and update the GEP, but I'm not sure if it has to be included in the present PR.
|
@DamianSawicki Correct. This is in line with section 3.3.5 of the Fetch standard:
This instance of Jake Archibald's CORS playground offers an extreme example: under the assumption that you haven't created any cookies (or client-side certificates, etc.) associated with |
DamianSawicki
left a comment
There was a problem hiding this comment.
We may want to follow up on exposeHeaders separately, but in the current scope as a quick improvement for 1.5.1 the PR looks good to me.
Thanks @snorwin!
/lgtm
Signed-off-by: Norwin Schnyder <norwin.schnyder+github@gmail.com>
|
@howardjohn PTAL, I’d really appreciate your opinion on this API documentation update. |
DamianSawicki
left a comment
There was a problem hiding this comment.
Nice catches in test case descriptions @snorwin! Re-lgtming.
/lgtm
|
/cherry-pick release-1.5 |
|
@snorwin: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Concur with revisiting /lgtm |
|
/approve |
|
as previously discussed, changes looks good, thanks for sticking on this and fixing all cors stuff folks |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DamianSawicki, kflynn, rikatz, snorwin The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@snorwin: #4663 failed to apply on top of branch "release-1.5": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What type of PR is this?
/kind documentation
/kind test
What this PR does / why we need it:
This PR updates the CORS API documentation to clarify how wildcard
*values interact with theallowCredentialsconfiguration and removes conformance tests that rely on detecting credentialed requests.Previously, parts of the documentation referred to credentialed requests, which may be misleading since the gateway cannot reliably determine whether a request is credentialed. Whether a request is treated as credentialed is determined by the browser, not the server or gateway.
Which issue(s) this PR fixes:
N/A
Does this PR introduce a user-facing change?: