mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 22:37:55 -05:00
Under IAM enforcement, CreateMultipartUpload, CompleteMultipartUpload, RestoreObject and SelectObjectContent were never checked against the caller's identity policies. They are POST requests, the registry had no S3 POST rule, and an action no rule maps is allowed. A user with no S3 permission could start and complete multipart uploads, restore objects and read them through Select. Many other S3 requests were checked as the wrong action: - ListParts and AbortMultipartUpload as s3:GetObject and s3:DeleteObject. - Object retention and legal hold as s3:GetObject and s3:PutObject, so a user allowed only to write objects could set a retention period or a legal hold. - Object annotations as the plain object actions. - A request naming a versionId as the current-version action. A deny on s3:DeleteObjectVersion, the usual guard against permanent deletes, did not stop one, and reading a version needed s3:GetObject rather than s3:GetObjectVersion. - Analytics, inventory and Intelligent-Tiering configurations as s3:ListBucket, s3:CreateBucket or s3:DeleteBucket. - DeleteBucketTagging as s3:DeleteBucketTagging, which is not an IAM action. A policy naming it granted the call, and one granting s3:PutBucketTagging, the action AWS checks, was refused. - A request naming two sub-resources as the first one the registry looked for. The controller runs a different one: GET ?acl&tagging returns the tags while needing only s3:GetObjectAcl. The object sub-resources are now resolved per method, in the order S3Controller dispatches them. A versionId selects the version action AWS checks for a read, head, delete, ACL or annotation request, and for Select, which S3Controller runs on the version named; the bucket configurations follow the controller's bucket chains. Tagging keeps the tagging actions: the tagging operations still act on the current version whatever versionId names, so a version tagging action would authorize one version and let the request change another. The actions come from the S3 user guide's "Required permissions for S3 API operations" and multipart permissions tables, the API reference and the Service Reference: - s3:PutObject for creating and completing an upload; - s3:RestoreObject, and s3:GetObject for Select; - s3:AbortMultipartUpload and s3:ListMultipartUploadParts; - the retention, legal-hold, version and configuration actions; - s3:PutBucketTagging for DeleteBucketTagging, and each configuration's Put action for its delete. A write carrying If-Match already needed s3:GetObject as well. The conditional-writes guide lists PutObject, CopyObject and CompleteMultipartUpload as the operations that take the header, so now that completing an upload is checked as s3:PutObject it gets that check too, while CreateMultipartUpload and UploadPart, which ignore the header, no longer do. A conditional delete with an If-Match ETag already needed s3:GetObject. A delete naming a version is now s3:DeleteObjectVersion, so that check covers it too, still as s3:GetObject: the conditional-deletes guide evaluates the condition against the current version only. Condition keys, per the Service Reference: - s3:versionid is given to the version actions. - s3:ExistingObjectTag is given to the version actions and the annotation actions, read from the version the request names. - DeleteBucketTagging, checked as s3:PutBucketTagging, keeps the bucket's tags in its context. CloudTrail denials name the version actions' operations, and give no name to a POST operation rather than a wrong one. The actions an operation needs besides its own, S3 behaviour behind these checks and S3's own bucket-policy check follow separately (#5716). Refs #5716