aristidb / aws

Amazon Web Services for Haskell
BSD 3-Clause "New" or "Revised" License
238 stars 107 forks source link

support S3 access without credentials, by using anonymousCredentials #281

Closed joeyh closed 1 year ago

joeyh commented 1 year ago

This allows using GetBucket and GetObject against a public S3 bucket. Other actions may also work for the rare bucket that supports unauthenticated writes.

anonymousCredentials generates a Credentials with the access key and secret key both empty. So AWS requests that do not support anonymous access will proceed the same ways that they currently do when the user sets AWS_ACCESS_KEY_ID="" and AWS_SECRET_ACCESS_KEY="". Eg, the AWS server will reject the request because it is not properly signed.

isAnonymousCredentials was added as a field of Credentials to allow differentiating between anonymousCredentials being used, and the user providing empty credentials. This avoids a behavior change when the user provides empty credentials to a program that uses S3. The new constructor means that the version needs to be bumped to eg 0.23.

Closes https://github.com/aristidb/aws/issues/279

joeyh commented 1 year ago

@aristidb could you review this? I think it's good enough to merge, but don't want to abuse my new maintainer powers by merging my own feature patches, if someone is available to review.