Project

General

Profile

Actions

Feature #70086

closed
YL YL

support service principals in bucket policy

Feature #70086: support service principals in bucket policy

Added by Yuval Lifshitz almost 2 years ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Tags (freeform):
Fixed In:
v20.0.0-957-g444f8651ec
Released In:
v20.2.0~697
Upkeep Timestamp:
2025-11-01T01:14:20+00:00

CB Updated by Casey Bodley almost 2 years ago Actions #1

from the example bucket policy in https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html#grant-log-delivery-permissions-bucket-policy:

            "Principal": {
                "Service": "logging.s3.amazonaws.com" 
            },

we'll first need to teach the iam policy parser about Service principals. that would happen in rgw_iam_policy.cc:parse_principal() and probably involve adding Service to the Principal::types enum

the bucket logging code would then call through verify_bucket_permission() to evaluate_iam_policies(), where the given const rgw::auth::Identity& identity would override Identity::is_identity(const Principal& p) to match such a service principal

            "Condition": {
                "ArnLike": {
                    "aws:SourceArn": "arn:aws:s3:::amzn-s3-demo-source-bucket" 
                },
                "StringEquals": {
                    "aws:SourceAccount": "SOURCE-ACCOUNT-ID" 
                }
            }

evaluate_iam_policies() uses the given const rgw::IAM::Environment& env to match conditions like this. the bucket logging code would have to add key/value pairs for these keys to that environment. you can find some examples of this in rgw_op.cc by searching for rgw_add_to_iam_environment(). for aws:SourceAccount, you should be able to use to_string(source_bucket_info.owner) as the value to match both user- and account owners

YL Updated by Yuval Lifshitz over 1 year ago Actions #2

  • Status changed from New to In Progress
  • Pull request ID set to 62284

YL Updated by Yuval Lifshitz over 1 year ago Actions #3

  • Status changed from In Progress to Resolved

UB Updated by Upkeep Bot over 1 year ago Actions #4

  • Merge Commit set to 444f8651ec82fe06152275f23a628871270dc639
  • Fixed In set to v20.0.0-957-g444f8651ec8
  • Upkeep Timestamp set to 2025-07-09T19:36:59+00:00

UB Updated by Upkeep Bot over 1 year ago Actions #5

  • Fixed In changed from v20.0.0-957-g444f8651ec8 to v20.0.0-957-g444f8651ec
  • Upkeep Timestamp changed from 2025-07-09T19:36:59+00:00 to 2025-07-14T18:13:54+00:00

UB Updated by Upkeep Bot about 1 year ago Actions #6

  • Released In set to v20.2.0~697
  • Upkeep Timestamp changed from 2025-07-14T18:13:54+00:00 to 2025-11-01T01:14:20+00:00
Actions

Also available in: PDF Atom