Skip to content

rgw: sync Keystone ACL strategies between S3 and Swift APIs - #68795

Open
senolcolak wants to merge 2 commits into
ceph:mainfrom
senolcolak:wip-scolak-rgw-s3-swift-acl-keystone
Open

senolcolak wants to merge 2 commits into
ceph:mainfrom
senolcolak:wip-scolak-rgw-s3-swift-acl-keystone

Conversation

@senolcolak

@senolcolak senolcolak commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When Keystone is the identity provider, ACLs set via the Swift API were not
honored by S3 API requests. The root cause: EC2Engine::get_acl_strategy()
returned nullptr, so S3 requests only matched ACLs by the bare project_id
string (via the default strategy in RemoteApplier::get_perms_from_aclspec()).
Swift ACLs store grantees in project:user colon-separated format, which the
default strategy cannot match.

This patch implements a complete ACL strategy in EC2Engine::get_acl_strategy()
mirroring the existing TokenEngine::get_acl_strategy() logic, factors the
shared body into one helper, and adds the authenticated wildcard *:*.

Changes (src/rgw/rgw_auth_keystone.cc)

  1. Replace the EC2Engine::get_acl_strategy() stub with a real strategy.
  2. Hoist the duplicated body into a free function
    rgw::auth::keystone::make_keystone_acl_strategy() taking plain strings
    and a roles list. Both engines now go through a thin envelope adapter,
    keystone_acl_strategy_from_token(). Behaviour is identical between
    Swift and S3 by construction.
  3. Add make_spec_item("*", "*") to allowed_items. Swift's
    keystoneauth._authorize_cross_tenant() iterates the full
    {tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} Cartesian
    product, so containers with X-Container-Read: *:* must grant read to
    any authenticated Keystone user. The previous six-element array silently
    denied this case in both engines.

Tests (src/test/rgw/test_rgw_auth_keystone.cc)

New unittest_rgw_auth_keystone covering:

  • All six identity combinations (project_id:user_id, name:name,
    project_id:*, name:*, *:user_id, *:user_name)
  • The new *:* authenticated wildcard
  • OR-ing of multiple matching grants
  • No-match and empty aclspec return zero permissions
  • System-reader admin role grants RGW_OP_TYPE_READ
  • Reader-without-admin does not grant
  • Bare role-name ACL elements are not honored (pinned deliberately —
    see "Out of scope" below)

Out of scope: bare-role-name ACLs (#68476)

Bare Keystone role names (e.g. X-Container-Read: Member) are not matched
against the aclspec. Swift's keystoneauth middleware scopes role-name ACL
elements to the project that owns the container (the tenant-mismatch gate
runs before the user_role-in-roles loop in
swift/common/middleware/keystoneauth.py). The acl_strategy_t callback in
RGW does not see the bucket owner, so a bare-role-name lookup here would
grant the permission to any token carrying that role regardless of project
scope, leaking access across Keystone projects in multi-tenant clouds.
Project-scoped role-name ACLs require a separate change that threads the
container/bucket owner through ACL evaluation.

How it works

RemoteApplier::get_perms_from_aclspec() calls extra_acl_strategy(aclspec)
if non-null and ORs the result into the permission mask. Returning a real
strategy from EC2Engine::get_acl_strategy() lets S3 Keystone requests
match Swift-format identity strings in the ACL spec map.

Documentation (doc/radosgw/keystone.rst)

Documents the cross-API ACL interoperability behavior and the supported
grant formats.

Test plan

  • Build: cd build && ninja bin/radosgw bin/unittest_rgw_auth_keystone
  • Unit: ctest -R unittest_rgw_auth_keystone
  • Existing: ctest -R rgw (no regressions)
  • Manual integration test with vstart + Keystone:
    1. Set container read ACL via Swift to project_id:user_id
    2. Access that container via S3 as that user → access granted
    3. Set container read ACL via Swift to *:*
    4. Access via S3 with any authenticated Keystone user → access granted
    5. Verify a user with neither matching identity nor any wildcard grant
      is denied

Fixes: https://tracker.ceph.com/issues/68492
Refs: https://tracker.ceph.com/issues/68476

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@senolcolak
senolcolak requested a review from a team as a code owner May 7, 2026 10:40
@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.

13 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.

@github-actions github-actions Bot added the rgw label May 7, 2026
@senolcolak

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@senolcolak
senolcolak force-pushed the wip-scolak-rgw-s3-swift-acl-keystone branch from ba20fad to 793682b Compare May 7, 2026 12:09
@senolcolak
senolcolak requested a review from a team as a code owner May 7, 2026 12:09
@senolcolak senolcolak changed the title rgw: sync S3 API ACLs with Swift API ACLs for Keystone auth rgw: sync Keystone ACL strategies between S3 and Swift APIs May 7, 2026
@senolcolak
senolcolak force-pushed the wip-scolak-rgw-s3-swift-acl-keystone branch from 793682b to 53f6468 Compare May 7, 2026 12:19
@senolcolak
senolcolak force-pushed the wip-scolak-rgw-s3-swift-acl-keystone branch from e9db1e0 to 53f6468 Compare May 7, 2026 14:31
@senolcolak
senolcolak marked this pull request as draft June 2, 2026 17:56
@senolcolak
senolcolak force-pushed the wip-scolak-rgw-s3-swift-acl-keystone branch from 53f6468 to f5c2c86 Compare June 2, 2026 20:05
senolcolak added a commit to senolcolak/ceph that referenced this pull request Jun 5, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
@senolcolak
senolcolak force-pushed the wip-scolak-rgw-s3-swift-acl-keystone branch from 2bceb21 to c022bde Compare August 21, 2026 12:25
senolcolak added a commit to senolcolak/ceph that referenced this pull request Aug 21, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
@senolcolak
senolcolak force-pushed the wip-scolak-rgw-s3-swift-acl-keystone branch from c022bde to c2f22c4 Compare August 21, 2026 12:36
The EC2Engine (S3 Keystone auth) previously returned nullptr for its
ACL strategy, meaning S3 requests could only match ACLs by the bare
project_id. This prevented Swift-format ACL entries (project:user) from
being honored by S3 requests.

Implement a full ACL strategy in EC2Engine::get_acl_strategy() that
matches all 6 combinations of project/user UUIDs and names, mirroring
the existing logic in TokenEngine::get_acl_strategy(). This enables
bidirectional ACL interoperability between Swift and S3 when Keystone
is the identity provider.

Bare Keystone role names (e.g. 'X-Container-Read: Member') are not
matched against the aclspec. Swift's keystoneauth scopes role-name ACL
elements to the project that owns the container (see
swift/common/middleware/keystoneauth.py: tenant-mismatch gate runs
before the user_role-in-roles loop). The acl_strategy_t callback in
RGW does not see the bucket owner, so a bare-role-name lookup here
would grant the permission to any token carrying that role regardless
of project scope, leaking access across Keystone projects in
multi-tenant clouds. Project-scoped role-name ACLs are out of scope
for this change and will need a separate follow-up that threads the
container/bucket owner through the ACL evaluation.

Fixes: https://tracker.ceph.com/issues/68492
Fixes: https://tracker.ceph.com/issues/68476
Signed-off-by: Senol Colak <[email protected]>
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
@senolcolak
senolcolak force-pushed the wip-scolak-rgw-s3-swift-acl-keystone branch from c2f22c4 to 0a96b7d Compare August 21, 2026 12:38
@senolcolak

Copy link
Copy Markdown
Contributor Author

Tested on a live deployment (Ceph squid + Keystone, RGW Swift backend for Glance images).
Deployed this patch and validated the Glance image-sharing use case end-to-end:

  • Owner project uploads image → shares via openstack image add project
  • Destination project accepts → downloads successfully with matching checksum (previously returned 0 bytes)
  • Public image (X-Container-Read: :) → readable by any authenticated Keystone project (previously 403)
  • Confirmed via RGW debug logs: from ACL got perm=16 where before the fix it was perm=0

Without the patch, cross-project and public Glance image reads fail with 401 AccessDenied. With it, they succeed.

senolcolak added a commit to senolcolak/ceph that referenced this pull request Aug 21, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor

At a quick glance looks sane to me.

@senolcolak

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@senolcolak

Copy link
Copy Markdown
Contributor Author

Would one of you be able to give it a formal review/approve when you have a moment? Once this lands in main I can unblock the squid backport (#70997), which is otherwise ready.

Really appreciate your time.

uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Sep 11, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
@ivancich

Copy link
Copy Markdown
Member

@mdw-at-linuxbox Please give this a formal review so the process can move forwards.

@adamemerson

Copy link
Copy Markdown
Contributor

ok to test

uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Sep 23, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Sep 24, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Sep 25, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Sep 25, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Sep 25, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Sep 28, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 1, 2026
Backport-Id: 01a08f3a-594a-74c8-a6e7-11286099fb49
Backport-PR: #12
Upstream-PRs: ceph#68795, ceph#70997
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 6, 2026
Backport-Id: 01a10c8c-a7a0-762d-bc2d-051616f550c4
Backport-PR: #22
Upstream-PRs: ceph#68795, ceph#71490
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

uw-sc pushed a commit to cobaltcore-dev/ceph that referenced this pull request Oct 14, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 14, 2026
Backport-Id: 01a08f3a-594a-74c8-a6e7-11286099fb49
Backport-PR: #12
Upstream-PRs: ceph#68795, ceph#70997
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 16, 2026
Backport-Id: 01a14449-fa55-75f8-a119-93a83c111aec
Backport-PR: #35
Upstream-PRs: ceph#68795, ceph#70997
dvanders pushed a commit to dvanders/ceph that referenced this pull request Oct 20, 2026
Both TokenEngine::get_acl_strategy() and EC2Engine::get_acl_strategy()
were producing the same lambda over the same Cartesian product of
{tenant_id, tenant_name} x {user_id, user_name} plus four wildcards.
Hoist the body into a shared free function make_keystone_acl_strategy()
and route both engines through a thin envelope adapter. The function
takes plain strings and a roles list so it is unit-testable without
constructing a Keystone TokenEnvelope.

Add the authenticated wildcard "*:*" to the allowed_items array.
Swift's keystoneauth _authorize_cross_tenant() iterates the full
{tenant_id, tenant_name, '*'} x {user_id, user_name, '*'} product, so a
container with X-Container-Read: *:* must grant read to any token-bearing
Keystone user. The previous six-element array silently denied this case
for both Swift (TokenEngine) and S3 (EC2Engine) requests.

Add unittest_rgw_auth_keystone covering each combination
(project:user, name:name, project:*, *:user, *:*), no-match,
multi-grant OR-ing, and the system-reader role grant. The
BareRoleNameIsNotHonored case pins the deliberate omission of
project-scoped role-name matching documented in PR ceph#68795: until
acl_strategy_t can see the bucket owner, matching a bare role name
would leak across projects.

Signed-off-by: Senol Colak <[email protected]>
(cherry picked from commit 0a96b7d)
(cherry picked from commit 68d8b41)
(cherry picked from commit 2da14c0)
Signed-off-by: Uwe Schwaeke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants