Skip to content

sts: test cross-account role permissions against bucket acls#703

Open
cbodley wants to merge 1 commit intoceph:masterfrom
cbodley:wip-73659
Open

sts: test cross-account role permissions against bucket acls#703
cbodley wants to merge 1 commit intoceph:masterfrom
cbodley:wip-73659

Conversation

@cbodley
Copy link
Copy Markdown
Contributor

@cbodley cbodley commented Oct 28, 2025

without any matching identity policy, test that an assumed role inherits acl-based permissions on the assuming user

test cases for ceph/ceph#66078

Comment thread s3tests/functional/test_sts.py Outdated
Comment thread s3tests/functional/test_sts.py Outdated

# access allowed from role assumed by alt user
s3_client.get_bucket_location(Bucket=bucket_name)

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.

@cbodley : should we add a test that has no role/session policy and no acl grant also for a non-owner and check if access is actually denied

Copy link
Copy Markdown
Contributor Author

@cbodley cbodley Oct 30, 2025

Choose a reason for hiding this comment

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

test_assume_role_owner_deny() above tests the non-owner case with no policy

edit: renamed to test_assume_role_nonowner_deny

Comment thread s3tests/functional/test_sts.py Outdated
Comment on lines +1084 to +1086
# GetObject for nonexistent object should be denied by session policy
e = assert_raises(ClientError, s3_client.get_object, Bucket=bucket_name_1, Key="test-1.txt")
assert (403, 'AccessDenied') == _get_status_and_error_code(e.response)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

https://qa-proxy.ceph.com/teuthology/cbodley-2025-10-29_16:55:02-rgw-wip-73659-distro-default-gibba/8575121/teuthology.log shows both of these get_object() calls succeeding, so i assume the tests are reusing the same bucket/object as other tests

Comment thread s3tests/functional/test_sts.py Outdated
Comment on lines +1159 to +1161
# GetObject for nonexistent object should be allowed by bucket policy
e = assert_raises(ClientError, s3_client.get_object, Bucket=bucket_name_1, Key="test-session-arn.txt")
assert (404, 'NoSuchKey') == _get_status_and_error_code(e.response)
Copy link
Copy Markdown
Contributor Author

@cbodley cbodley Oct 30, 2025

Choose a reason for hiding this comment

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

from https://qa-proxy.ceph.com/teuthology/cbodley-2025-10-30_13:41:08-rgw:sts-wip-73659-distro-default-gibba/8576808/teuthology.log

        # GetObject for nonexistent object should be allowed by bucket policy
        e = assert_raises(ClientError, s3_client.get_object, Bucket=bucket_name_1, Key="test-session-arn.txt")
>       assert (404, 'NoSuchKey') == _get_status_and_error_code(e.response)
E       AssertionError: assert (404, 'NoSuchKey') == (403, 'AccessDenied')

oops, 404 vs 403 is controlled by s3:ListBucket permissions: https://github.com/ceph/ceph/blob/7cb26500b8/src/rgw/rgw_op.cc#L474-L479

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ended up going with a different strategy to avoid object acls - i replaced the object operations GetObject/PutObject with bucket operations GetBucketLocation/ListBucket. because the policy resources accept both bucket- and object ARNs, this should provide the same test coverage for interactions between bucket/role/session policies

i finally got a successful run of rgw/sts with this change in https://pulpito.ceph.com/cbodley-2025-10-30_15:23:25-rgw:sts-wip-73659-distro-default-gibba/

@cbodley cbodley force-pushed the wip-73659 branch 2 times, most recently from ebf727c to 3a6b20b Compare October 30, 2025 15:22
Signed-off-by: Casey Bodley <cbodley@redhat.com>
@cbodley cbodley changed the title sts: test tenant role permissions against bucket acls sts: test cross-account role permissions against bucket acls Apr 13, 2026
@cbodley
Copy link
Copy Markdown
Contributor Author

cbodley commented Apr 13, 2026

existing test_cross_account_role_policy_allow() tests cross-account permissions with the combination of role policy and bucket policy. i duplicated this in test_cross_account_role_policy_allow_acl() by replacing the bucket policy with a bucket acl grant

as expected, the test case fails against main but passes with the RoleApplier changes from ceph/ceph#66078

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants