mirror of
https://github.com/floci-io/floci.git
synced 2026-12-02 09:47:56 -05:00
A general purpose bucket's tags control access to it only once attribute-based access control (ABAC) is enabled on it: "By default, ABAC is disabled for all Amazon S3 general purpose buckets", and aws:ResourceTag is evaluated "only after you enable ABAC on your bucket". Floci served neither PutBucketAbac nor GetBucketAbac and answered both 501 NotImplemented. The bucket now holds an ABAC status, read and written at the bucket's owner as its other configurations are. PutBucketAbac takes a whole AbacStatus document holding one Status of text alone, sets Enabled or Disabled and refuses anything else, a broken document, markup inside Status or a lowercase status among it, with MalformedXML "The XML you provided was not well-formed or did not validate against our published schema", the status left as it was; GetBucketAbac answers Disabled until it is set. While it is Enabled, PutBucketTagging and DeleteBucketTagging are refused with BadRequest "This S3 general purpose bucket has attribute-based access control (ABAC) enabled. To add tags to this bucket, initiate a TagResource request. To delete tags from this bucket, initiate an UntagResource request.", the tags kept: S3 Control's TagResource and UntagResource change them, and GetBucketTagging still lists them. The statuses, codes and sentence are AWS's recorded answers; DeleteBucketTagging's refusal, which no recording gives, takes the same answer, whose sentence speaks to deleting too, as the API reference says the operation can no longer be used. IAM already checks the two operations as s3:PutBucketAbac and s3:GetBucketAbac from the vendored REST routes. PutBucketAbac sets the status under the lock the tag writes hold, so a PutBucketTagging that saw ABAC disabled finishes before it is enabled. CreateBucket now sets the tags its CreateBucketConfiguration carries on the new bucket before storing it, and a repeated create of a bucket the caller already owns, which the default Region answers as done, leaves that bucket's tags as they are, so neither can change the tags of a bucket under ABAC. S3BucketAbacIntegrationTest checks, through the SDK, the Disabled default and the roundtrip, the refused spellings and bodies with the status kept, a repeated create leaving an ABAC bucket's tags, and, under ABAC, PutBucketTagging and DeleteBucketTagging refused with the tags kept, TagResource tagging and PutBucketTagging working again once ABAC is disabled; IamActionRegistryTest the two operations' IAM actions; S3UnservedBucketSubresourceIntegrationTest no longer counts ?abac unserved.