Skip to content

rgw: stop crashing when an admin tries to assume a nonexistent role - #67863

Merged
mheler merged 1 commit into
ceph:mainfrom
mheler:wip-bug-75569
Apr 20, 2026
Merged

mheler merged 1 commit into
ceph:mainfrom
mheler:wip-bug-75569

Conversation

@mheler

@mheler mheler commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

An admin user sending an AssumeRole request for a role that doesn't exist would crash rgw. The permission check failed but got overridden because the caller was an admin, and the code that ran next blindly assumed the role had already been loaded. Fixed by loading the role directly instead of hoping it was done earlier.

To reproduce:

# 1. Create an admin user
radosgw-admin user create --uid=adminuser --display-name="Admin" --admin

# 2. Create any role
radosgw-admin role create --role-name=crashtest --path=/ --assume-role-policy-doc='{"Version":"2012-10-17","Statement" [{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":"sts:AssumeRole"}]}'

# 3. AssumeRole with a wrong path in the ARN → crash
aws sts assume-role \
    --role-arn "arn:aws:iam:::role/bogus/crashtest" \
    --role-session-name test \
    --endpoint-url http://localhost:8000

Fixes: https://tracker.ceph.com/issues/75569

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.

An admin user sending an AssumeRole request for a role that doesn't
exist would crash rgw. The permission check failed but got
overridden because the caller was an admin, and the code that ran
next blindly assumed the role had already been loaded. Fixed by
loading the role directly instead of hoping it was done earlier.

Signed-off-by: Matthew N. Heler <[email protected]>
@mheler
mheler requested a review from a team as a code owner March 17, 2026 20:51
@github-actions github-actions Bot added the rgw label Mar 17, 2026
@mheler
mheler requested review from cbodley and mattbenjamin March 17, 2026 22:07
Comment thread src/rgw/rgw_sts.cc
Comment on lines +408 to +410
auto [ret, r] = getRoleInfo(dpp, req.getRoleARN(), y);
if (ret < 0) {
response.retCode = ret;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's unfortunate that we have to load the role twice, but the second should at least be served by the metadata cache

when fixing this issue elsewhere, the strategy was to move the fallible parts into a RGWOp::init_processing() override which can return errors before the call to verify_permission(). #50648 shows one example of this

i had looked into this for AssumeRole in the past, but the fact that sts has its own Request/Response abstractions separate from RGWOp makes it hard to do

@anrao19

anrao19 commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

FYI, pr testing is in progress...
Tracker created for same is : https://tracker.ceph.com/issues/76011

@anrao19

anrao19 commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

FYI, pr testing is in progress... Tracker created for same is : https://tracker.ceph.com/issues/76011

Pr testing completed and approved by @ivancich, More details in : https://tracker.ceph.com/issues/76011.
@mheler , if no further testing needed we can merge this pr

@mheler
mheler merged commit cdf35a1 into ceph:main Apr 20, 2026
10 checks passed
@mheler
mheler deleted the wip-bug-75569 branch April 20, 2026 15:04
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.

3 participants