Skip to content

umbrella: rgw: match CORS rules like Amazon S3 - #69651

Merged
batrick merged 6 commits into
ceph:umbrellafrom
RaminNietzsche:wip-77583-umbrella
Jul 28, 2026
Merged

batrick merged 6 commits into
ceph:umbrellafrom
RaminNietzsche:wip-77583-umbrella

Conversation

@RaminNietzsche

@RaminNietzsche RaminNietzsche commented Jun 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Backport of #69190 to umbrella.

RGW previously selected a CORS rule with host_name_rule() (origin only), then
validated method and headers on that single rule. Bucket configs with multiple
CORSRule elements sharing the same AllowedOrigin but different
AllowedMethod values could fail preflight when a later rule should match.
This aligns rule selection with Amazon S3 (first rule matching origin, method,
and preflight headers).

Why umbrella: the buggy origin-only matching exists on umbrella; users running
multi-rule bucket CORS on umbrella RGW hit the same preflight failures fixed on
main.

Minimal change: cherry-pick of all six commits from PR #69190 with git cherry-pick -x. No manual conflict resolution was required (umbrella includes
global CORS like main).

Parent tracker: https://tracker.ceph.com/issues/77575
Official backport tracker: https://tracker.ceph.com/issues/77585

Testing

  • Includes unittest_rgw_cors (from main PR)
  • Not run locally on umbrella yet

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

Fixes: https://tracker.ceph.com/issues/77585

RaminNietzsche and others added 6 commits June 22, 2026 20:32
Select the first CORSRule whose AllowedOrigin, AllowedMethod, and (for
preflight) AllowedHeader all match the request. Previously host_name_rule
matched origin only, so a second rule with the same origin but different
methods was never used.

Add RGWCORSRule::matches() and RGWCORSConfiguration::match_rule(), wire
generate_cors_headers and RGWOptionsCORS to them (including global CORS), and
add unittest_rgw_cors.

Signed-off-by: ramin.najarbashi <[email protected]>
Co-authored-by: Cursor <[email protected]>
(cherry picked from commit cc1dcec)
Signed-off-by: ramin.najarbashi <[email protected]>
(cherry picked from commit bbec695)
Signed-off-by: ramin.najarbashi <[email protected]>
(cherry picked from commit b5624b6)
- matches_method: reject null/empty method; short-circuit RGW_CORS_ALL
- matches_preflight_headers: add logging for skip and disallowed headers
- generate_cors_headers: capture req_meth/req_hdrs in lambda
- remove unused validate_cors_rule_method/header helpers

Signed-off-by: ramin.najarbashi <[email protected]>

On branch fix/rgw-cors-aws-rule-matching
Changes to be committed:
	modified:   src/rgw/rgw_cors.cc
	modified:   src/rgw/rgw_op.cc

(cherry picked from commit 8b3f907)
get_multi_cors_method_flags() calls ceph::for_each_substr(), but
rgw_cors.h did not include str_list.h. The CORS unit test includes
only this header, so the build failed with an undeclared identifier.
Qualify the call and add the missing include.

Signed-off-by: ramin.najarbashi <[email protected]>
(cherry picked from commit 830f0e5)
unittest_rgw_cors used GMock::Main without global_init, so dout() in
RGWCORSRule::matches() dereferenced a null g_ceph_context and segfaulted
on the first test. Link unit-main like unittest_rgw_compression.

Assisted-by: Cursor:composer-2.5-fast
Signed-off-by: ramin.najarbashi <[email protected]>
Co-authored-by: Cursor <[email protected]>
(cherry picked from commit c147865)
@RaminNietzsche
RaminNietzsche requested a review from a team as a code owner June 22, 2026 17:02
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

14 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

github-actions[bot]

This comment was marked as duplicate.

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Jun 22, 2026
@cbodley

cbodley commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

updated pr description with

backport tracker: https://tracker.ceph.com/issues/77585

@github-actions github-actions Bot added the releng-audit-pass Release engineering: passed backport verification audit. label Jun 27, 2026
@anrao19

anrao19 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

pr testing completed and approved by @ivancich , more details : https://tracker.ceph.com/issues/77820
@RaminNietzsche , if no further testing needed then this pr can be merged

@anrao19

anrao19 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

jenkins test windows

@anrao19

anrao19 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

@batrick

batrick commented Jul 20, 2026

Copy link
Copy Markdown
Member

retest this please

@batrick batrick added the releng-audit-queue Release engineering: queued for backport verification audit. label Jul 20, 2026
@github-actions github-actions Bot added releng-audit-pass Release engineering: passed backport verification audit. and removed releng-audit-queue Release engineering: queued for backport verification audit. releng-audit-pass Release engineering: passed backport verification audit. labels Jul 20, 2026
@batrick

batrick commented Jul 20, 2026

Copy link
Copy Markdown
Member

retest this please

@yuriw

yuriw commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri-testing-20260724.161317-umbrella.

@yuriw

yuriw commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@RaminNietzsche this PR is part of the wip-yuri-testing integration batch and still needs review approval before it can be merged. Could you request a review or ping a reviewer? Thanks!

@batrick

batrick commented Jul 27, 2026

Copy link
Copy Markdown
Member

jenkins test api

@batrick

batrick commented Jul 27, 2026

Copy link
Copy Markdown
Member

jenkins test windows

@batrick
batrick merged commit 4694f79 into ceph:umbrella Jul 28, 2026
37 of 39 checks passed
@batrick batrick modified the milestones: umbrella, v21.1.1 Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/ops needs-qa releng-audit-pass Release engineering: passed backport verification audit. rgw tests wip-yuri-testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants