Project

General

Profile

Actions

Bug #62033

closed
TU TU

http options cors request on a presigned url does not work on multi-tenant keystone buckets

Bug #62033: http options cors request on a presigned url does not work on multi-tenant keystone buckets

Added by Tobias Urdin over 3 years ago. Updated 4 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
pacific quincy reef
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Fixed In:
v18.0.0-5589-g100bb99706
Released In:
v19.2.0~1786
Upkeep Timestamp:
2025-07-14T19:10:08+00:00

Description

If I create a presigned url for a test.txt object in a bucket named demo-preflight that I get an URL like:
https://rgw/demo-preflight/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=censored&X-Amz-Date=20230716T114238Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=censored

I can curl -X GET this url and get the content, but if I curl -X OPTIONS with proper "Origin: rgw" and "Access-Control-Request-Method: GET" headers I get an NoSuchBucket error because
rgw does not expand the demo-preflight bucket to be the 42a1f5eb42635e3d81cc8b3c0b81a567/demo-preflight bucket for a multi-tenant keystone setup.

If I curl -X OPTIONS but with the bucket part of the URL like 42a1f5eb42635e3d81cc8b3c0b81a567:demo-preflight the HTTP OPTIONS call returns HTTP 200 OK but the HTTP GET call for the same URL gives a 403 forbidden

https://rgw/42a1f5eb42635e3d81cc8b3c0b81a567:demo-preflight/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=censored&X-Amz-Date=20230716T114238Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=censored

expected result: we should be able to do http options call without the full-path bucket name as "42a1f5eb42635e3d81cc8b3c0b81a567:demo-preflight" as we have the credentials for the presigned url we should expand that ourselves

we can see in the logs
2023-07-16T13:20:52.385+0200 7f61db188700 20 req 10002870918102420338 0.001000088s get_handler handler=22RGWHandler_REST_Obj_S3
2023-07-16T13:20:52.385+0200 7f61db188700 10 req 10002870918102420338 0.001000088s handler=22RGWHandler_REST_Obj_S3
2023-07-16T13:20:52.385+0200 7f61db188700 2 req 10002870918102420338 0.001000088s getting op 6
2023-07-16T13:20:52.385+0200 7f61db188700 10 req 10002870918102420338 0.001000088s s3:options_cors op=26RGWOptionsCORS_ObjStore_S3
2023-07-16T13:20:52.385+0200 7f61db188700 2 req 10002870918102420338 0.001000088s s3:options_cors verifying requester
2023-07-16T13:20:52.385+0200 7f61db188700 20 req 10002870918102420338 0.001000088s s3:options_cors rgw::auth::StrategyRegistry::s3_main_strategy_t: trying rgw::auth::s3::AWSAuthStrategy
2023-07-16T13:20:52.385+0200 7f61db188700 20 req 10002870918102420338 0.001000088s s3:options_cors rgw::auth::s3::AWSAuthStrategy: trying rgw::auth::s3::S3AnonymousEngine
2023-07-16T13:20:52.385+0200 7f61db188700 20 req 10002870918102420338 0.001000088s s3:options_cors rgw::auth::s3::S3AnonymousEngine granted access
2023-07-16T13:20:52.385+0200 7f61db188700 20 req 10002870918102420338 0.001000088s s3:options_cors rgw::auth::s3::AWSAuthStrategy granted access
2023-07-16T13:20:52.385+0200 7f61db188700 2 req 10002870918102420338 0.001000088s s3:options_cors normalizing buckets and tenants
2023-07-16T13:20:52.385+0200 7f61db188700 10 req 10002870918102420338 0.001000088s s->object=test.txt->bucket=demo-preflight
2023-07-16T13:20:52.385+0200 7f61db188700 2 req 10002870918102420338 0.001000088s s3:options_cors init permissions
2023-07-16T13:20:52.385+0200 7f61db188700 20 req 10002870918102420338 0.001000088s s3:options_cors get_system_obj_state: rctx=0x7f61db17e660 obj=rgw.meta:root:demo state=0x5576b20ce9a0 s->prefetch_data=0
2023-07-16T13:20:52.385+0200 7f61db188700 10 req 10002870918102420338 0.001000088s s3:options_cors cache get: name=rgw.meta+root+demo : hit (negative entry)
2023-07-16T13:20:52.385+0200 7f61db188700 10 req 10002870918102420338 0.001000088s s3:options_cors init_permissions on <NULL> failed, ret=-2002
2023-07-16T13:20:52.385+0200 7f61db188700 1 req 10002870918102420338 0.001000088s op->ERRORHANDLER: err_no=-2002 new_err_no=-2002

when we change the bucket part of the url to 42a1f5eb42635e3d81cc8b3c0b81a567:demo-preflight we get below which makes the HTTP OPTIONS cors request pass
2023-07-16T13:20:52.385+0200 7f61db188700 10 req 10002870918102420338 0.001000088s s->object=test.txt->bucket=42a1f5eb42635e3d81cc8b3c0b81a567/demo-preflight


Related issues 3 (0 open — 3 closed)

Copied to rgw - Backport #62505: pacific: http options cors request on a presigned url does not work on multi-tenant keystone bucketsResolvedMykola Golub

Actions
Copied to rgw - Backport #62506: reef: http options cors request on a presigned url does not work on multi-tenant keystone bucketsResolvedMykola Golub

Actions
Copied to rgw - Backport #62507: quincy: http options cors request on a presigned url does not work on multi-tenant keystone bucketsResolvedMykola Golub

Actions

TU Updated by Tobias Urdin over 3 years ago Actions #1

I have a feeling this https://github.com/ceph/ceph/blob/82ddbb6cd1fbf3c9f827fcc4c5470c8412b813c0/src/rgw/rgw_rest_s3.cc#L6424 line should be moved below the discover_aws_flavour() call, untested so I will see if I can test that later but I assume based on analyzing the code path that when the anonymous auth is applicable it wouldn’t parse bucket tenant from credentials

  AwsVersion version;
  AwsRoute route;
  std::tie(version, route) = discover_aws_flavour(s->info);
  if (s->op == OP_OPTIONS && version == AwsVersion::UNKNOWN) {
    return true;
  }

CB Updated by Casey Bodley over 3 years ago Actions #2

  • Status changed from New to Triaged

CB Updated by Casey Bodley over 3 years ago Actions #4

  • Status changed from Triaged to Fix Under Review
  • Pull request ID set to 52673

TU Updated by Tobias Urdin over 3 years ago Actions #5

if we could get this s3-tests https://github.com/ceph/s3-tests/pull/523 patch executed against a keystone rgw setup

CB Updated by Casey Bodley over 3 years ago Actions #6

  • Assignee set to Tobias Urdin

CB Updated by Casey Bodley over 3 years ago Actions #7

  • Status changed from Fix Under Review to Resolved

CB Updated by Casey Bodley over 3 years ago Actions #8

  • Status changed from Resolved to Pending Backport
  • Backport set to pacific quincy reef

UB Updated by Upkeep Bot over 3 years ago Actions #9

  • Copied to Backport #62505: pacific: http options cors request on a presigned url does not work on multi-tenant keystone buckets added

UB Updated by Upkeep Bot over 3 years ago Actions #10

  • Copied to Backport #62506: reef: http options cors request on a presigned url does not work on multi-tenant keystone buckets added

UB Updated by Upkeep Bot over 3 years ago Actions #11

  • Copied to Backport #62507: quincy: http options cors request on a presigned url does not work on multi-tenant keystone buckets added

UB Updated by Upkeep Bot over 1 year ago Actions #13

  • Merge Commit set to 100bb9970615915dbd5af71cfd25b793aa7d601c
  • Fixed In set to v18.0.0-5589-g100bb997061
  • Released In set to v19.2.0~1786
  • Upkeep Timestamp set to 2025-07-09T16:43:40+00:00

UB Updated by Upkeep Bot over 1 year ago Actions #14

  • Fixed In changed from v18.0.0-5589-g100bb997061 to v18.0.0-5589-g100bb99706
  • Upkeep Timestamp changed from 2025-07-09T16:43:40+00:00 to 2025-07-14T19:10:08+00:00

AE Updated by Adam Emerson 4 months ago Actions #15

  • Status changed from Pending Backport to Resolved
Actions

Also available in: PDF Atom