Skip to content

CORS conformance fixes regarding credentials and wildcards - #4542

Merged
k8s-ci-robot merged 4 commits into
kubernetes-sigs:mainfrom
DamianSawicki:CORS-conformance-fixes
Feb 17, 2026
Merged

k8s-ci-robot merged 4 commits into
kubernetes-sigs:mainfrom
DamianSawicki:CORS-conformance-fixes

Conversation

@DamianSawicki

@DamianSawicki DamianSawicki commented Feb 16, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind test
/area conformance-test

What this PR does / why we need it:

  1. One test case verified gateway behavior with a requests not adhering to HTTP standards. The request is turned into a valid one in this PR.
  2. The above test case verified the lack of wildcards in access-control-allow-origin, but not in access-control-allow-methods. Now, both are covered.
  3. The next test case allowed wildcards in access-control-allow-origin and access-control-allow-methods, but not in access-control-allow-headers. Now, wildcards are allowed in all three.
  4. The PR also adds test cases for simple credentialed requests as suggested by @snorwin via dm.

More details can be found in the corresponding commit descriptions.

Which issue(s) this PR fixes:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/test area/conformance-test Issues or PRs related to Conformance tests. labels Feb 16, 2026
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 16, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @DamianSawicki. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 16, 2026
@DamianSawicki
DamianSawicki marked this pull request as ready for review February 16, 2026 12:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 16, 2026
@DamianSawicki

Copy link
Copy Markdown
Contributor Author

/assign @rikatz

@snorwin

snorwin commented Feb 16, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 16, 2026
@snorwin

snorwin commented Feb 16, 2026

Copy link
Copy Markdown
Member

/cc @snorwin

@k8s-ci-robot
k8s-ci-robot requested a review from snorwin February 16, 2026 13:04
@DamianSawicki

Copy link
Copy Markdown
Contributor Author

/retest

@snorwin snorwin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DamianSawicki.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 17, 2026
@snorwin

snorwin commented Feb 17, 2026

Copy link
Copy Markdown
Member

/remove-lgtm

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 17, 2026
Comment thread conformance/tests/httproute-cors.go Resolved
Comment thread conformance/tests/httproute-cors.go Resolved
Preflight requests cannot be credentialed as per
https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#preflight_requests_and_credentials
so we remove the `Authorization` header from the test preflight request
while adding a comment that it may be included in the subsequent actual
request.

Signed-off-by: Damian Sawicki <dsawicki@google.com>
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 17, 2026
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 17, 2026
Comment thread conformance/tests/httproute-cors.go Resolved
The test case required the Origin to be echoed in
`access-control-allow-origin`, while in fact also the Method
should be echoed in `access-control-allow-methods` for a credentialed
request as per
https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#credentialed_requests_and_wildcards

This is now fixed.

Signed-off-by: Damian Sawicki <dsawicki@google.com>
For test symmetry, we allow a wildcard as the value of
access-control-allow-headers, where it is allowed as the value of
access-control-allow-origin and access-control-allow-methods.

Signed-off-by: Damian Sawicki <dsawicki@google.com>
For simple credentialed requests, the new test cases verify echoing
the Origin in the Access-Control-Allow-Origin header and setting or
omitting the Access-Control-Allow-Credentials header depending on the
config.

Signed-off-by: Damian Sawicki <dsawicki@google.com>

@snorwin snorwin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

I successfully verified the tests with the Airlock Microgateway.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 17, 2026
@robscott

Copy link
Copy Markdown
Member

Thanks @DamianSawicki!

/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DamianSawicki, robscott, snorwin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 17, 2026
@k8s-ci-robot
k8s-ci-robot merged commit c4014fb into kubernetes-sigs:main Feb 17, 2026
8 checks passed
@robscott

Copy link
Copy Markdown
Member

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown
Contributor

@robscott: new pull request created: #4547

Details

In response to this:

/cherry-pick release-1.5

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.

danehans pushed a commit to danehans/gateway-api that referenced this pull request Mar 10, 2026
…s-sigs#4542)

* CORS preflight requests cannot contain credentials

Preflight requests cannot be credentialed as per
https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#preflight_requests_and_credentials
so we remove the `Authorization` header from the test preflight request
while adding a comment that it may be included in the subsequent actual
request.

Signed-off-by: Damian Sawicki <dsawicki@google.com>

* Require also methods to be echoed with credentials

The test case required the Origin to be echoed in
`access-control-allow-origin`, while in fact also the Method
should be echoed in `access-control-allow-methods` for a credentialed
request as per
https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#credentialed_requests_and_wildcards

This is now fixed.

Signed-off-by: Damian Sawicki <dsawicki@google.com>

* Allow wildcards in access-control-allow-headers

For test symmetry, we allow a wildcard as the value of
access-control-allow-headers, where it is allowed as the value of
access-control-allow-origin and access-control-allow-methods.

Signed-off-by: Damian Sawicki <dsawicki@google.com>

* Add test cases for simple credentialed requests

For simple credentialed requests, the new test cases verify echoing
the Origin in the Access-Control-Allow-Origin header and setting or
omitting the Access-Control-Allow-Credentials header depending on the
config.

Signed-off-by: Damian Sawicki <dsawicki@google.com>

---------

Signed-off-by: Damian Sawicki <dsawicki@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/conformance-test Issues or PRs related to Conformance tests. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/test lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants