Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --policy should imply --user-permissions-boundary=none #74

Closed
simonw opened this issue Jul 11, 2022 · 2 comments
Closed

Using --policy should imply --user-permissions-boundary=none #74

simonw opened this issue Jul 11, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Jul 11, 2022

I ran into this problem here:

If you use --policy but forget to set --user-permissions-boundary=none you are likely to generate credentials that can't be used, because they only work with S3.

@simonw simonw added the enhancement New feature or request label Jul 11, 2022
@simonw
Copy link
Owner Author

simonw commented Jul 11, 2022

I also added --statement in:

Used like this:

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

Passing that option should assume --user-permissions-boundary=none too.

@simonw
Copy link
Owner Author

simonw commented Jul 11, 2022

Looks like --user-permissions-boundary isn't covered by any tests at all at the moment.

Prototype implementation of this change:

 diff --git a/s3_credentials/cli.py b/s3_credentials/cli.py
index 2aed5e9..25f9e25 100644
--- a/s3_credentials/cli.py
+++ b/s3_credentials/cli.py
@@ -328,6 +328,9 @@ def create(
     if write_only:
         permission = "write-only"
 
+    if not user_permissions_boundary and (policy or extra_statements):
+        user_permissions_boundary = "none"
+
     s3 = None
     iam = None
     sts = None

@simonw simonw closed this as completed Aug 1, 2022
simonw added a commit that referenced this issue Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant