grantRead on a Secret should also grant DescribeSecret #6444
Labels
@aws-cdk/aws-secretsmanager
Related to AWS Secrets Manager
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
good first issue
Related to contributions. See CONTRIBUTING.md
The
grantRead
method will only give permission for thesecretsmanager:GetSecretValue
action on a secret and won't also grant permission for thesecretsmanager:DescribeSecret
action.This is unintuitive as granting permission for retrieval should also grant permission to read the metadata.
Use Case
Creating an RDS DatabaseInstance will create a DatabaseSecret in the Secrets Manager. This secret can be used by the
aws-secretsmanager-jdbc
package to connect to the database.When having e.g. a Spring Boot application running on ECS, you can grant the task role read access to the secret using:
But this is not enough; the
aws-secretsmanager-jdbc
package will try to interact with the secret using thesecretsmanager:DescribeSecret
action as well. So apart from thegrantRead
above, you will need to attach an inline policy to grant the missing action:Proposed Solution
I would expect
grantRead
to give full read access to the secret and it's metadata to the specified role. So thegrantRead
method should grant permissions for bothsecretsmanager:GetSecretValue
andsecretsmanager:DescribeSecret
.Otherwise further permission functions like
grantReadDescribe
might be useful.Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: