Skip to content

tentacle: rgw/keystone: fix Swift ACL evaluation and add EC2Engine ACL strategy - #71490

Draft
senolcolak wants to merge 2 commits into
ceph:tentaclefrom
senolcolak:backport/tentacle/rgw-s3-swift-acl-keystone
Draft

senolcolak wants to merge 2 commits into
ceph:tentaclefrom
senolcolak:backport/tentacle/rgw-s3-swift-acl-keystone

Conversation

@senolcolak

Copy link
Copy Markdown
Contributor

Backport of PR #68795 (targeting main) to tentacle (Ceph 20.x).

⚠️ Do not merge yet — this backport depends on upstream #68795, which is not
yet merged to main. Opened as a draft to enable cherry-pick image builds for testing.

Two bugs fixed:

  1. *:* wildcard missing from TokenEngine's allowed_items — containers with
    X-Container-Read: *:* returned 403 to any cross-project Keystone token.
  2. EC2Engine::get_acl_strategy() returned nullptr — S3 requests could never match
    Swift-format ACL entries.

Both caused Glance shared image downloads to return zero bytes with
swift_store_multi_tenant = True.

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

Backport notes

  • Faithful cherry-pick (-x) of both commits from rgw: sync Keystone ACL strategies between S3 and Swift APIs #68795; code is byte-identical to upstream.
  • One conflict resolved in src/test/rgw/CMakeLists.txt: tentacle has no
    if(WITH_RADOSGW_RADOS) guard around the rgw test targets, so the new
    unittest_rgw_auth_keystone block was placed among the unguarded targets (matching
    tentacle's structure). No functional difference from upstream.

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]>
(cherry picked from commit e05a139)
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)
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ceph Release Engineering Audit Report

Automated Redmine Linkage Audit

The following tracking irregularities were found:

  • Missing Original PR(s): Could not identify any main PRs associated with this backport. Ensure the backport commits properly reference the original PRs.
  • Orphaned Backport PR: Could not find any Redmine tracker linked directly to this backport PR #71490.

Automated Backport Parity Review - Unmerged Commits Detected

This backport contains cherry-picks of commits that do not appear to be merged into the main branch (could not find an associated merge commit or PR). Backports should only contain commits that have already been merged upstream.

Unmerged Cherry-Picks

Be familiar with the rules and guidelines for writing backports.


Automated Backport Parity Review

Discrepancies detected between the backport PR and the original source PR(s). Please see the Commit Parity Visualizer below.


Commit Parity Visualizer

BACKPORT PR #71490 SOURCE PR SOURCE STATUS
b6e6b1c rgw: sync Keystone ACL strategies between S3 and Swift APIs <<<< EXTRA IN BACKPORT >>>>
6e22571 rgw/keystone: extract shared ACL strategy and add : wildcard <<<< EXTRA IN BACKPORT >>>>

Automated Backport Parity Review - Cherry-Pick Conflicts / Deviations

⚠️ WARNING: Cherry-pick conflicts or deviations were found that require component lead review.

A conflict or deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.

This does not necessarily indicate an issue but a maintainer should review.

**Click to expand conflict summaries.**

Deviation in Backport 6e22571 (cherry-pick of 0a96b7d)

Affected File(s)

Range Diff

Click to expand
--- Original (0a96b7d4)
+++ Backport (6e225714)
@@ -24,3 +24,4 @@
 would leak across projects.
 
 Signed-off-by: Senol Colak <[email protected]>
+(cherry picked from commit 0a96b7d44d90126a656575e53629565fcdd9d58b)

================================================================================
RANGE DIFF
================================================================================

1:  0a96b7d44d9 ! 1:  6e225714b30 rgw/keystone: extract shared ACL strategy and add *:* wildcard
    @@ Commit message
         would leak across projects.
     
         Signed-off-by: Senol Colak <[email protected]>
    +    (cherry picked from commit 0a96b7d44d90126a656575e53629565fcdd9d58b)
     
      ## src/rgw/rgw_auth_keystone.cc ##
     @@ src/rgw/rgw_auth_keystone.cc: make_spec_item(const std::string& tenant, const std::string& id)
    @@ src/test/rgw/CMakeLists.txt: add_executable(unittest_http_manager test_http_mana
     +add_ceph_unittest(unittest_rgw_auth_keystone)
     +target_link_libraries(unittest_rgw_auth_keystone ${rgw_libs})
     +
    - if(WITH_RADOSGW_RADOS)
      # unittest_rgw_reshard_wait
      add_executable(unittest_rgw_reshard_wait test_rgw_reshard_wait.cc)
    + add_ceph_unittest(unittest_rgw_reshard_wait)
     
      ## src/test/rgw/test_rgw_auth_keystone.cc (new) ##
     @@

How to proceed:

  • Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git Conflicts: block intact) and include an explanation for changes.
  • Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
  • Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting /audit override.

Be familiar with the rules and guidelines for writing backports.


🛟 Need Help?

If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.

📋 Component Lead / Release Manager

To override the audit failure, apply releng-audit-override label or comment /audit override.


⚠️ Note: Automated audit checks will be suspended on future pushes to prevent comment spam while you work.

When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.

View workflow run

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Sep 2, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/ops documentation needs-ci-approval releng-audit-fail Release engineering: failed backport verification audit. rgw tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant