Skip to content

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

Open
senolcolak wants to merge 2 commits into
ceph:squidfrom
senolcolak:backport/squid/rgw-s3-swift-acl-keystone
Open

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

Conversation

@senolcolak

Copy link
Copy Markdown
Contributor

Backport of the fix from PR #68795 (targeting main) to squid.

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

@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 #70997.

Automated Backport Parity Review - Invalid Commit Format

The following commits have an invalid format. Backport commits must either include a standard (cherry picked from commit ...) line or start with the target branch name (e.g., squid:).

  • f4e53556 rgw/keystone: fix Swift ACL evaluation and add EC2Engine ACL strategy

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 #70997 SOURCE PR SOURCE STATUS
f4e5355 rgw/keystone: fix Swift ACL evaluation and add EC2Engine ACL strategy <<<< EXTRA IN BACKPORT >>>>

🛟 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 Aug 12, 2026
@senolcolak
senolcolak force-pushed the backport/squid/rgw-s3-swift-acl-keystone branch 2 times, most recently from 2825a9d to 2007dec Compare August 13, 2026 15:31
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)
@senolcolak

Copy link
Copy Markdown
Contributor Author

we validated the patch is working on our Swift Glance environment.

@senolcolak
senolcolak marked this pull request as ready for review September 2, 2026 10:42
@senolcolak
senolcolak requested review from a team as code owners September 2, 2026 10:42
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 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
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