Skip to main content

GetObjectAcl

GetObjectAcl returns an object's access control list (ACL) - the list of who may do what with the object. On STRG, objects share their bucket's ACL rather than carrying one of their own, so every object answers with its bucket's: private when the bucket is Protected, and public-read when its Bucket Protection is off. That keeps things simple - one setting per bucket decides who can read its objects. The same answer, asked of the bucket itself, comes from GetBucketAcl.

Good to know on STRG
  • The answer is the bucket's ACL, so it is always private or public-read, with no per-object grants to account for.
  • The owner, and the owner's grant, name your STRG account.
  • x-amz-expected-bucket-owner is welcome and has nothing to check: a key only ever reaches buckets of its own account.

When you'd use it​

  • Checking a link before sharing it. An app or an agent about to hand someone a plain URL to an object can first confirm the object is public-read, so the link opens for whoever receives it.
  • Tools written for Amazon S3. Backup tools, sync clients and file browsers that read an object's ACL to show or copy its permissions get an answer in the shape they expect.

Request​

GET /photos/2024/cat.jpg?acl HTTP/1.1
Host: my-bucket.s3.eu-central-1.strg.com
Authorization: AWS4-HMAC-SHA256 Credential=...
x-amz-date: 20260926T120000Z
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

The path-style form is GET /my-bucket/photos/2024/cat.jpg?acl on s3.eu-central-1.strg.com - Addressing explains both.

Permissions​

The access key needs Read objects (objects:read). For a key limited to certain buckets or to a key prefix, the bucket and the object key are within them; anything else answers 403 AccessDenied. Access keys has the details.

URI parameters​

NameTypeRequiredDescription
BucketStringYesThe bucket that holds the object.
KeyStringYesThe object's key. A key containing a . or .. path segment (a/../b) cannot be put in a URL and answers 400 InvalidURI; its ACL is its bucket's, which GetBucketAcl reads.
aclFlagYesSelects the ACL subresource. Sent with no value.
versionIdStringNoA specific version of the object. Without it, the current version is used.

Request headers​

NameTypeRequiredDescription
x-amz-expected-bucket-ownerStringNoWelcome, with nothing to check: an access key only ever reaches its own account's buckets.
x-amz-request-payerStringNoHas no effect: STRG has no Requester Pays buckets, so there is never a need to send it.

Request body​

None.

Response​

Response headers​

NameDescription
Content-Typeapplication/xml
x-amz-request-idThe request ID, handy for a support request.

x-amz-request-charged is never returned, since STRG has no Requester Pays.

Response body​

The answer is an AccessControlPolicy document. Its elements are:

ElementDescription
OwnerThe owner. ID and DisplayName both carry your STRG account ID.
AccessControlListThe grants (Grants in the SDKs). Always one Grant giving the owner FULL_CONTROL, plus - when the bucket's Bucket Protection is off - one giving the AllUsers group READ.
Grant / GranteeFor the owner, a CanonicalUser grantee whose ID and DisplayName are your account ID. For public read, a Group grantee with URI http://acs.amazonaws.com/groups/global/AllUsers.
Grant / PermissionFULL_CONTROL for the owner, READ for AllUsers.

Here is the answer for an object in a Protected (private) bucket:

<?xml version="1.0" encoding="UTF-8"?>
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>your-account-id</ID>
<DisplayName>your-account-id</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>your-account-id</ID>
<DisplayName>your-account-id</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>

An object in a bucket whose Bucket Protection is off answers the same document with a second Grant, to the AllUsers group, for READ.

What public-read means

With public-read, anyone can read the object without signing - a GetObject or HeadObject on the bucket's regional endpoint. Reading its ACL, GetObjectAcl included, still takes a signed request. Anonymous reads has the details.

Errors​

These are the errors this request can return, and the situation behind each one.

CodeHTTP statusWhen
NoSuchKey404The object does not exist.
NoSuchBucket404The bucket does not exist, it is in a region other than the endpoint's, or the account has no storage in this endpoint's region yet.
AccessDenied403The access key lacks Read objects, the bucket or key is outside its buckets or prefix, the account is not active, or the request is unsigned.
InvalidAccessKeyId403The access key does not exist, has expired or been revoked - or it was created moments ago and is not usable yet in this region where the account already stores data, in which case the same request works shortly afterwards.
InvalidURI400The key contains a . or .. path segment.
SignatureDoesNotMatch403The request signature does not match.
RequestTimeTooSkewed403The request time is more than 15 minutes from the server's.
AuthorizationHeaderMalformed400The signature's credential scope names a region other than the endpoint's.
NotImplemented501The request carries a query parameter other than acl and versionId (presigning's X-Amz-* parameters aside).
SlowDown503Too many requests. The Retry-After header says when a retry is welcome; the AWS SDKs retry on their own.
ServiceUnavailable503A temporary failure; the same request can be retried.
InternalError500An unexpected failure; the same request can be retried.

Differences from Amazon S3​

The table lists each place where STRG behaves differently, and what that means for a client.

AspectAmazon S3STRG
Object ACLsEach object has its own ACLAn object's ACL is always its bucket's - one setting per bucket. PutObjectAcl succeeds when it matches
GrantsAny combination of grants to users, groups and email addressesOwner FULL_CONTROL, plus AllUsers READ for a bucket whose Bucket Protection is off - two cases, nothing more to interpret
OwnerYour AWS canonical user IDYour STRG account ID, in both ID and DisplayName
Anonymous requestsAllowed when READ_ACP is granted to everyoneAlways signed: an unsigned request answers 403 AccessDenied
Bucket in another region301 redirect with x-amz-bucket-region404 NoSuchBucket. A bucket is reached through its own regional endpoint
Keys with . or .. segmentsAllowed400 InvalidURI. Such a key's ACL is its bucket's, which GetBucketAcl reads
x-amz-expected-bucket-ownerChecked against the bucket ownerWelcome, with nothing to check

Examples​

Reading the ACL of photos/2024/cat.jpg in my-bucket, and telling whether it is public:

aws s3api get-object-acl \
--bucket my-bucket \
--key photos/2024/cat.jpg \
--endpoint-url https://s3.eu-central-1.strg.com \
--region eu-central-1

A specific version is read by adding --version-id (CLI), VersionId= (boto3) or VersionId (JavaScript) with the version's ID.

View as Markdown