Git Product home page Git Product logo

Comments (10)

simonw avatar simonw commented on August 19, 2024

One option would be to support multiple --statement options, each of which can be either a chunk of JSON or some kind of shortcut that indicates one of a number of pre-baked patterns.

Could support --statement textract:all or --statement textract:async as shortcuts.

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

I need a better feeling for what other kinds of shortcuts might be useful.

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

https://aws.amazon.com/blogs/security/back-to-school-understanding-the-iam-policy-grammar/ says:

There are five core types of elements that you can use in your policy. Some are required and some are optional. Let's walk through them.

  1. Effect (Required) -- specifies whether the statement will explicitly allow ("Allow") or deny ("Deny") access. These are the only two values that are valid in this element.
  2. Action* (Required) -- describes the type of access that should be allowed or denied.
  3. Resource* (Required) -- specifies the object or objects that the statement covers.
  4. Principal* (Optional) -- specifies the user, account, service, or other entity that is allowed or denied access to a resource. Principals can only be used for resource-based policies. For policies within IAM, the policy is attached to the Principal it applies to.
  5. Condition (Optional) -- lets you specify conditions for when a policy is in effect.

So Effect, Action and Resource are required.

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

I'm tempted to say that --statement action:name-of-action is a shortcut for adding a Effect: Allow, Action: Action, Resource: * statement.

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

I have a full list (I think) of potential actions here: https://iam-definitions.vercel.app/iam/privileges

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

Alternative design: --allow-action 'textract:*' which would add this:

[
    {
        "Effect": "Allow",
        "Action": ["textract:*"],
        "Resource": "*"
    }
]

But given that, what would the shortcut be if you didn't want to use "Resource": "*"?

Maybe --allow-action-on-resource <action> <resource> could be supported too?

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

I'm just going to implement --statement <json> which takes the full block of JSON and --allow-action <action> which adds an allow block on resource * for that specified action.

If you pass --allow-action multiple times they will all be bundled in the same statement.

I'm not going to implement shortcut templates, because I don't have a good idea for what they should be - and textract:* is a good enough solution for the moment.

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

Updated documentation:

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

I decided to just implement --statement for the moment, and not to implement that --allow-action idea.

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

I tested this like so and it worked:

s3-credentials create simonw-ocr-demo-bucket --statement '{
  "Effect": "Allow",
  "Action": "textract:*",
  "Resource": "*"
}' -c > ocr.json

Then tested like so:

s3-credentials put-object simonw-ocr-demo-bucket github-octoverse-2020-community-report.pdf ~/Downloads/2020-reports/github-octoverse-2020-community-report.pdf -a ocr.json
s3-ocr start simonw-ocr-demo-bucket -a ocr.json --all
s3-ocr status simonw-ocr-demo-bucket -a ocr.json
s3-ocr index simonw-ocr-demo-bucket /tmp/github-index.db -a ocr.json
datasette /tmp/github-index.db -p 8525

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.