-
Notifications
You must be signed in to change notification settings - Fork 2
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
added secretsmanager read only #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way we provide the secretsmanager key etc is fine if we add some error handling, but don't think the actual policy is going to achieve what we need it to as is.
iam_builder/templates.py
Outdated
"secretsmanager:ListSecrets", | ||
], | ||
"Effect": "Allow", | ||
"Resource": f"arn:aws:secretsmanager:::secret:{secret_name}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expectation is that secret resource will be of the format arn:aws:secretsmanager:<region>:<account>:secret:<name_of_secret>-<hex_code>
. As such, a user should be able to supply either the name of a specific secret, in which case we should be granting them access to ``arn:aws:secretsmanager:eu-west-1:㊙️<name_of_secret>-*`, or they should supply a wild_carded secret value which we can grant access to. Currently, this will fail to grant the access required I suspect.
iam_builder/iam_builder.py
Outdated
@@ -91,6 +92,12 @@ def build_iam_policy(config: dict) -> dict: # noqa: C901 | |||
iam["Statement"].append(secrets_statement) | |||
iam["Statement"].extend(iam_lookup["decrypt_statement"]) | |||
|
|||
if "secretsmanager" in config: | |||
secretsmanager_read_only = get_secretsmanager_read_only_policy( | |||
config["secretsmanager"]["read_only"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly weird given that we don't have a corresponding write
access level. We should have specific error handling for if users try and pass in the same keys they do for S3 (e.g. write_only
, read_write
that throw errors to the end user that these levels of access have not been implemented in iam_builder
.
Newly added tests are not actually running - can you modify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than one tiny suggestion it’s good to merge
iam_builder/schemas/iam_schema.json
Outdated
@@ -85,6 +85,19 @@ | |||
"type": "string" | |||
} | |||
}, | |||
"secretsmanager": { | |||
"description": "A secret that the iam_role should be able to acces.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "A secret that the iam_role should be able to acces.", | |
"description": "A secret that the iam_role should be able to access.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s try it
No description provided.