Git Product home page Git Product logo

Comments (5)

simonw avatar simonw commented on September 28, 2024

This is the hardest policy to design. Now that I've done read-only in #23 and write-only in #25 I can create this as a super-set of those two - maybe combining their statements directly? Is there anything else this policy should cover?

from s3-credentials.

simonw avatar simonw commented on September 28, 2024

From #15 (comment) I know it needs GetBucketLocation:

I tried to use this tool with https://litestream.io/ (the original inspiration for building this) and discovered that the current read-write mode isn't enough, because Litestream needs access to s3:GetBucketLocation.

from s3-credentials.

simonw avatar simonw commented on September 28, 2024

Here's what "Action": "s3:*Object" actually matches: https://iam-definitions.vercel.app/iam/privileges?_sort=rowid&privilege__like=%25Object&service__exact=s3

  • s3:DeleteObject
  • s3:GetObject
  • s3:PutObject
  • s3:ReplicateObject
  • s3:RestoreObject

from s3-credentials.

simonw avatar simonw commented on September 28, 2024

I'm not going to grant these two:

  • RestoreObject: "Grants permission to restore an archived copy of an object back into Amazon S3"
  • ReplicateObject: "Grants permission to replicate objects and object tags to the destination bucket"

So I'll do the read-only permissions, plus additional permissions for Delete/Put.

from s3-credentials.

simonw avatar simonw commented on September 28, 2024

New policy is:

def read_write(bucket):
return _policy(read_write_statements(bucket))
def read_write_statements(bucket):
# https://github.com/simonw/s3-credentials/issues/24
return read_only_statements(bucket) + [
{
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:DeleteObject"],
"Resource": ["arn:aws:s3:::{}/*".format(bucket)],
}
]
def read_only(bucket):
return _policy(read_only_statements(bucket))
def read_only_statements(bucket):
# https://github.com/simonw/s3-credentials/issues/23
return [
{
"Effect": "Allow",
"Action": ["s3:ListBucket", "s3:GetBucketLocation"],
"Resource": ["arn:aws:s3:::{}".format(bucket)],
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectAcl",
"s3:GetObjectLegalHold",
"s3:GetObjectRetention",
"s3:GetObjectTagging",
],
"Resource": ["arn:aws:s3:::{}/*".format(bucket)],
},
]

from s3-credentials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.