Skip to content

rgw: fix aclRequired for bucket-logging - #64251

Merged
yuvalif merged 1 commit into
ceph:mainfrom
nbalacha:wip-nbalacha-71730
Jul 16, 2025
Merged

yuvalif merged 1 commit into
ceph:mainfrom
nbalacha:wip-nbalacha-71730

Conversation

@nbalacha

@nbalacha nbalacha commented Jun 30, 2025 •

Copy link
Copy Markdown
Contributor

The aclRequired field in the bucket log is meant to indicate that an acl was required to authorize the operation. This change introduces a new field in the req_state to track whether an acl was checked to authorize the request.

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

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

@nbalacha
nbalacha requested a review from a team as a code owner June 30, 2025 04:53
@github-actions github-actions Bot added the rgw label Jun 30, 2025
@nbalacha

Copy link
Copy Markdown
Contributor Author

This is still WIP. Created the PR to get the approach reviewed.

Comment thread src/rgw/rgw_common.h Outdated

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.

since, in some of the function invocations, the return value is ignored, it is probably better to either use bool* with nullptr indication that the caller does not care about this, or use std::optional<bool> with std::nullopt indicating that the caller does not care.
if you use either with defaults, you would not need to change code that does not set the req_state

@yuvalif

yuvalif commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

@nbalacha
nbalacha force-pushed the wip-nbalacha-71730 branch from 61b83ea to fe1c28b Compare July 3, 2025 11:03
@nbalacha

nbalacha commented Jul 3, 2025

Copy link
Copy Markdown
Contributor Author

@pritha-srivastava , can you please see if the auth changes are fine?

Comment thread src/rgw/rgw_common.cc Outdated

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.

returning false mean that there is no permission. but ACL may still be require in this case?

@nbalacha nbalacha Jul 4, 2025 •

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.

I'd interpreted it to mean that the op was allowed because it was allowed by the acl. I'm not sure if we want to set ACLRequired to true when the op was denied.

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.

I tend to agree with Yuval that aclRequired field could be set to Yes even when the request is denied using an ACL (its definition is not very clear to me in https://docs.aws.amazon.com/AmazonS3/latest/userguide/LogFormat.html). Couldn't the user use this to check if the request was allowed/denied using an acl or other IAM policies.

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.

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.

It is not very clear but from the blog: "requests that were dependent on an ACL for access to objects in S3". I take it to mean that the request was authorized based on an ACL. In such a case, the user would know that a policy would be required to provide access to this object.

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.

agree its is not clear. i guess that the only way to know is to try with AWS.
but, regardless, I think, it would be ok to leave as-is: set a dash if ACL rejected the request.

@cbodley cbodley left a comment

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.

how important is this feature? i really want to keep this permission logic as simple and understandable as possible

Comment thread src/rgw/rgw_common.cc Outdated

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.

can we find a better name for this? i would interpret this to control whether authorization should require an acl

maybe something like acl_was_required or granted_by_acl?

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.

Done.

@nbalacha
nbalacha force-pushed the wip-nbalacha-71730 branch from fe1c28b to cafe08c Compare July 4, 2025 04:54
@yuvalif

yuvalif commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

matching s3-test: ceph/s3-tests#667

@yuvalif yuvalif removed the needs-test label Jul 7, 2025
The aclRequired field in the bucket log is meant to indicate
that an acl was required to authorize the operation. This change
introduces a new field in the req_state to track whether an acl was
checked to authorize the request.

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

Signed-off-by: N Balachandran <[email protected]>
@nbalacha
nbalacha force-pushed the wip-nbalacha-71730 branch from cafe08c to 7ab0704 Compare July 7, 2025 08:37
@nbalacha
nbalacha requested a review from a team as a code owner July 7, 2025 08:37
Comment thread src/rgw/rgw_common.cc
ps->bucket_access_conf->ignore_public_acls())) {
ldpp_dout(dpp, 10) << __func__ << ": granted by bucket acl" << dendl;
if (granted_by_acl) {
*granted_by_acl = true;

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.

once this PR is merged, buckets with BucketOwnerEnforced will ignore the default generated bucket owner ACL.
in this case, granted_by_acl will be set to false (even if default ACL exists).
until then, granted_by_acl will be set to true in any bucket without policy, even for operations done by the owner.
@cbodley, @pritha-srivastava does it sound reasonable?

@nbalacha

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@nbalacha

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@yuvalif
yuvalif merged commit ec8e31a into ceph:main Jul 16, 2025
@batrick

batrick commented Jul 16, 2025

Copy link
Copy Markdown
Member

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

I found one or more 'Fixes:' tags in the commit messages in

git log ec8e31a^..ec8e31a

The referenced tickets are:

https://tracker.ceph.com/issues/71730

Those tickets do not reference this merged Pull Request. If this
Pull Request merge resolves any of those tickets, please update the
"Pull Request ID" field on each ticket. A future run of this
script will appropriately update them.

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.

5 participants