Repository navigation
umbrella: rgw: match CORS rules like Amazon S3 - #69651
Conversation
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)
|
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
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
updated pr description with
|
|
pr testing completed and approved by @ivancich , more details : https://tracker.ceph.com/issues/77820 |
|
jenkins test windows |
|
jenkins test make check |
|
retest this please |
|
retest this please |
|
This PR has been added to wip-yuri-testing-20260724.161317-umbrella. |
|
@RaminNietzsche this PR is part of the |
|
jenkins test api |
|
jenkins test windows |
Summary
Backport of #69190 to umbrella.
RGW previously selected a CORS rule with
host_name_rule()(origin only), thenvalidated method and headers on that single rule. Bucket configs with multiple
CORSRuleelements sharing the sameAllowedOriginbut differentAllowedMethodvalues 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 includesglobal CORS like main).
Parent tracker: https://tracker.ceph.com/issues/77575
Official backport tracker: https://tracker.ceph.com/issues/77585
Testing
unittest_rgw_cors(from main PR)Contribution Guidelines
Checklist
Fixes: https://tracker.ceph.com/issues/77585