Skip to content

rgw: Policy evalaution logging - #67732

Merged
adamemerson merged 9 commits into
ceph:mainfrom
adamemerson:wip-policy-ux
Jul 24, 2026
Merged

adamemerson merged 9 commits into
ceph:mainfrom
adamemerson:wip-policy-ux

Conversation

@adamemerson

@adamemerson adamemerson commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

Add option rgw copious policy logging to dump a trace of policy evaluation to the log. Also add rgw-policy-test to verbosely evaluate policies from the command line.

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

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.

@github-actions

Copy link
Copy Markdown

Config Diff Tool Output

+ added: rgw_copious_policy_logging (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.

@adamemerson

Copy link
Copy Markdown
Contributor Author

/config check ok

Comment thread doc/man/8/rgw-policy-test.rst Resolved
Comment thread src/common/options/rgw.yaml.in Resolved
Comment thread src/common/options/rgw.yaml.in Resolved
@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

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Jun 16, 2026
@adamemerson
adamemerson requested a review from a team as a code owner June 26, 2026 19:15
@adamemerson
adamemerson requested a review from mheler June 26, 2026 19:16
@github-actions github-actions Bot removed the stale label Jun 26, 2026
@adamemerson

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@jmundack

Copy link
Copy Markdown
Contributor

I think this will be a really useful feature for users and operators! (thanks for adding this in)

I had one question about the backport tags i see in the tracker - It looks like this is being tagged/considered for backports to Tentacle and Umbrella. Since this is a feature rather than a bug fix, could you clarify the reasoning for backporting it? Are features normally backported in this case?

And if we do want to backport it, should we consider all supported releases - so including Squid as well, rather than only Tentacle/Umbrella?

@github-actions

github-actions Bot commented Jul 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

@adamemerson

Copy link
Copy Markdown
Contributor Author

I think this will be a really useful feature for users and operators! (thanks for adding this in)

I had one question about the backport tags i see in the tracker - It looks like this is being tagged/considered for backports to Tentacle and Umbrella. Since this is a feature rather than a bug fix, could you clarify the reasoning for backporting it? Are features normally backported in this case?

And if we do want to backport it, should we consider all supported releases - so including Squid as well, rather than only Tentacle/Umbrella?

The backport to squid is a good deal more disruptive.

@anthonyeleven

Copy link
Copy Markdown
Contributor

Are features normally backported in this case?

There is precedent, but that doesn't mean they should be routinely. My sense is that historically it's been case-by-case.

Comment thread doc/man/8/rgw-policy-test.rst Resolved
Comment thread doc/man/8/rgw-policy-test.rst Resolved
Comment thread doc/man/8/rgw-policy-test.rst Resolved
Comment thread doc/man/8/rgw-policy-test.rst Resolved
Comment thread src/common/options/rgw.yaml.in Resolved
Comment thread src/rgw/rgw_poltester.cc Resolved
Comment thread PendingReleaseNotes Resolved
Comment thread doc/man/8/rgw-policy-test.rst Resolved
Comment thread PendingReleaseNotes Resolved

@mheler mheler 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.

LGTM, some doc nits to take care of though.

@adamemerson
adamemerson force-pushed the wip-policy-ux branch 2 times, most recently from 39f98ee to 1a6bc63 Compare July 9, 2026 13:44
@adamemerson
adamemerson requested a review from mheler July 16, 2026 21:07
@adamemerson

Copy link
Copy Markdown
Contributor Author

@BBoozmen Added PrincipalIdentity to make poltester/policy testing better match the server, if you want to take another look.

Comment thread src/rgw/rgw_iam_policy.cc Resolved
Comment thread src/rgw/rgw_iam_policy.cc Resolved
Comment thread src/rgw/rgw_auth.cc
}

bool
PrincipalIdentity::is_identity(const Principal& p) const

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.

Would a wildcard identity nullify NotPrincipal deny statements?

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.

No, it would trigger it.

Though 'Wildcard Identity' would only show up in the context of someone specifying one to rgw-policy-test, rather than in live RGW. So an 'imaginary' identity that can be constructed in a test if you want but doesn't correspond to anything RGW will ever see. (And PrincipalIdentity is explicitly not used in actual RGW. I could make the comment more explicit.)

Comment thread src/rgw/rgw_poltester.cc Resolved
Comment thread ceph.spec.in Resolved
Typo in a lookup table.

Signed-off-by: Adam C. Emerson <[email protected]>
Create a log entry where we can fill a buffer with `format` instead of
needing to go through stringstream.

Signed-off-by: Adam C. Emerson <[email protected]>
Signed-off-by: Adam C. Emerson <[email protected]>
When the `rgw_copious_policy_logging` option is set to true, a
detailed trace of policy evaluation is logged.

Assisted-by: Claude Opus 4.6 <[email protected]>
(I wanted to see how it performed on rebase conflict resolution.)
Assisted-by: Claude Fable 5 <[email protected]>
(I figured I should have it look at the policy evaluation code for
bugs while it's included, and it found a few mistakes in output.)
Signed-off-by: Adam C. Emerson <[email protected]>
This is an identity backed by a `Principal`, for use when we don't
have any sort of RGW driver.

Signed-off-by: Adam C. Emerson <[email protected]>
Annotated evaluation of a policy.

Signed-off-by: Adam C. Emerson <[email protected]>
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