Skip to content

rgw/keystone: add project-scoped reader role - #70372

Merged
supriti merged 3 commits into
ceph:mainfrom
supriti:wip-rgw-keystone-project-reader
Oct 12, 2026
Merged

supriti merged 3 commits into
ceph:mainfrom
supriti:wip-rgw-keystone-project-reader

Conversation

@supriti

@supriti supriti commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

The existing rgw_keystone_accepted_reader_roles is system-scoped. It grants read access across all Keystone projects and only takes effect when the role is also listed in rgw_keystone_accepted_admin_roles.

This commit adds rgw_keystone_accepted_project_reader_roles for a project-scoped reader, mirroring Swift's project_reader_roles. When the listed role is the only granting role on a token, the identity is restricted to read-only within its Keystone project: perm_mask is set to RGW_PERM_READ instead of RGW_PERM_FULL_CONTROL.

With rgw_keystone_implicit_tenants=true every Keystone user in a project maps to the same RGW owner (the project account), so a reader reads and lists every bucket the project owns through the normal owner-scoped reads. Buckets owned by a different owner (e.g. a local RGW user) are not visible unless a policy grant access.

The reader is marked by perm_mask == RGW_PERM_READ on a TYPE_KEYSTONE identity, which keeps Swift read-only subusers (same perm_mask) from being treated as project readers.

Also rename is_reader to is_system_reader and add is_project_reader to tell the two role types apart.

On-behalf-of: SAP [email protected]

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.

@supriti
supriti requested review from a team as code owners July 21, 2026 09:38
@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.

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

@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 commented Jul 21, 2026 •

Copy link
Copy Markdown

Config Diff Tool Output

+ added: rgw_keystone_accepted_project_reader_roles (rgw.yaml.in)
+ added: rgw_keystone_implicit_deny_roles (rgw.yaml.in)
! changed: rgw_keystone_accepted_reader_roles: old:  (rgw.yaml.in)
! changed: rgw_keystone_accepted_reader_roles: new: Keystone roles granting system-scoped read access (Swift system_reader_roles equivalent). The role must also be listed in rgw_keystone_accepted_admin_roles. (rgw.yaml.in)
! changed: rgw_keystone_accepted_reader_roles: old: List of roles that can only be used for reads (Keystone). (rgw.yaml.in)
! changed: rgw_keystone_accepted_reader_roles: new: Keystone roles granting system-scoped read access. (rgw.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@supriti
supriti force-pushed the wip-rgw-keystone-project-reader branch from a426bc3 to f0f5a26 Compare July 21, 2026 11:48
@cbodley
cbodley requested a review from zaitcev July 21, 2026 14:47
@supriti
supriti force-pushed the wip-rgw-keystone-project-reader branch from f0f5a26 to c56be8c Compare July 28, 2026 08:53
@supriti
supriti force-pushed the wip-rgw-keystone-project-reader branch from c56be8c to ed2f7f0 Compare July 28, 2026 09:10
@anrao19

anrao19 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

jenkins test windows

@anrao19

anrao19 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

@mheler

mheler commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@supriti can you create a tracker for this?

@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

@supriti
supriti force-pushed the wip-rgw-keystone-project-reader branch from c04bf07 to 9a7b273 Compare September 29, 2026 10:34
@supriti

supriti commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

@anrao19

anrao19 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by anuchaithra started 2026-09-18-10:20.

pr testing completed and approved by @ivancich , more details in : https://tracker.ceph.com/issues/80179. @supriti , if no further testing is needed then this pr can be merged

would need to do re run of pr testing as there are new commits added

@anrao19

anrao19 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by anuchaithra started 2026-09-30-07:27.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

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

The existing rgw_keystone_accepted_reader_roles is system-scoped: it
grants read access across all Keystone projects and only takes effect
when the role is also listed in rgw_keystone_accepted_admin_roles.

This commit adds rgw_keystone_accepted_project_reader_roles for a
project-scoped reader, mirroring Swift's project_reader_roles. When the
listed role is the only granting role on a token, the identity is capped
to read-only within its Keystone project: perm_mask is set to
RGW_PERM_READ | RGW_PERM_READ_ACP, read object data and inspect bucket
configuration (ACLs, policy, versioning, location,..). Writes are denied.

This cap is a floor, not a hard ceiling: a bucket or IAM policy naming
the user (keystone:userid / keystone:role) can still grant specific writes.
CreateBucket and Swift account-metadata writes, which bypass the per-bucket
ACL check, are refused up front for a capped Keystone identity.

Like an admin role, a project-reader role admits the user on its own; it
need not also appear in rgw_keystone_accepted_roles. The most permissive
accepted role wins, so a user that also holds a plain accepted role (e.g.
member) or admin receives full control.

Every Keystone user in a project maps to the same RGW owner: the
project account (acct_user = project id), so a reader reads and lists
every bucket the project owns through the normal owner-scoped paths, and
cannot reach another project (a different owner). This scoping is by
ownership and holds regardless of rgw_keystone_implicit_tenants, which
only controls the bucket-name namespace (per-project vs. global);
implicit_tenants=true is recommended.

Because the reader is itself the project owner, owner-scoped grant paths
(bucket mdsearch, SNS topics) go through a new verify_owner_permission()
helper so ownership alone does not lift the cap. STS AssumeRole is a
separate case: it would swap in a role identity that carries no perm_mask,
so it is refused outright for a capped identity.

Also rename is_reader to is_system_reader and add is_project_reader to
tell the two role types apart.

Add unit tests.

Fixes: https://tracker.ceph.com/issues/81098
On-behalf-of: SAP <[email protected]>
Signed-off-by: Supriti Singh <[email protected]>
Building on the project-scoped reader, add
rgw_keystone_implicit_deny_roles: a Keystone role that authenticates a
user but grants no implicit permissions.

When such a role is the only granting role on a token,
effective_perm_mask() returns RGW_PERM_NONE, so the user is
authenticated but denied every operation by default (implicit deny).
Access must then come from an explicit bucket or IAM policy naming the
user (keystone:userid / keystone:role), and applies only to the buckets
and objects the policy names.

Like the reader, an implicit-deny role admits the user on its own (it
need not also be in rgw_keystone_accepted_roles), and the most permissive
accepted role still wins: admin, a project-reader, or another accepted
role such as member takes precedence over the implicit-deny cap.

Add the is_implicit_deny role flag and the config list, extend
effective_perm_mask, and add unit tests.

Fixes: https://tracker.ceph.com/issues/81098
On-behalf-of: SAP <[email protected]>
Signed-off-by: Supriti Singh <[email protected]>
Simplify how roles map to permissions by introducing an optional
permission value (perm_tier) in the TokenEnvelope. Compute it once while
updating the roles, instead of keeping several per-role flags and
resolving them later in Role::perm_mask() / effective_perm_mask().

update_roles() now derives the token's permission mask directly:

  nullopt        no accepted role -> token rejected
  RGW_PERM_NONE  implicit-deny
  READ|READ_ACP  project-reader
  FULL_CONTROL   plain accepted or admin

The most permissive role wins. admitted() replaces the duplicate role
checks in both auth engines and the admin check uses the is_admin flag;
only admin and system-reader stay as per-role flags.

Fixes: https://tracker.ceph.com/issues/81098
On-behalf-of: SAP <[email protected]>
Signed-off-by: Supriti Singh <[email protected]>
@supriti
supriti force-pushed the wip-rgw-keystone-project-reader branch from 9a7b273 to dcc1de7 Compare October 2, 2026 10:45
@anrao19

anrao19 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by anuchaithra started 2026-09-30-07:27.

pr testing completed and approved by @ivancich. More details in : https://tracker.ceph.com/issues/81163.
@supriti , if no further testing is needed then this can be merged

@supriti
supriti merged commit 0d863a4 into ceph:main Oct 12, 2026
15 of 16 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/38252636684

uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 14, 2026
Backport-Id: 01a0d759-c470-741d-8768-e3924fdfb44e
Backport-PR: #18
Upstream-PRs: ceph#70372
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 16, 2026
Backport-Id: 01a14417-d161-7221-87ad-c32f7e8170ec
Backport-PR: #33
Upstream-PRs: ceph#70372
s0nea added a commit to cobaltcore-dev/ceph that referenced this pull request Nov 4, 2026
Backport-Id: 01a18d83-9554-7c5f-8407-f6a30b7f3c9f
Backport-PR: #46
Upstream-PRs: ceph#70372
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.

6 participants