-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(aws-key): Secret with KMS that calls secret.grantRead() in another stack causes cyclic reference #14213
Comments
Thanks for the bug report and reproduction steps! I agree #3732 is related, but also #5765 and also #10160 (due to interactions with The cyclic reference is caused by the Key policy being updated with the grant for the user in the From a quick look and repro, I believe the fix here would likely be shared with the fix for #10160, where the In the mean time, I agree with your workaround, although you could certainly tighten up those permissions a bit. I believe the below is the minimal set of permissions necessary: accessRole.addToPolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'],
resources: [s3HostStack.secret.secretArn],
}));
accessRole.addToPolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['kms:Decrypt'],
resources: [s3HostStack.key.keyArn],
conditions: { 'kms:ViaService': `secretsmanager.${Stack.of(this).region}.amazonaws.com` },
})); |
I ended up using an alternate workaround before seeing the response.
|
I saw this also when using I had to use the alternate workaround from @prli above of "reimporting" the secret via |
Calling secret.grantRead() in another stack on a secret encrypted with KMS would result in cyclic reference error.
Reproduction Steps
What did you expect to happen?
able to grant read permission to secrets encrypted with KMS successfully
What actually happened?
Environment
Other
Similar issue - #3732
As a workaround, i am calling
addToPolicy()
to grant permission on the secret and key using their ARN. Any better workaround suggestions are welcome.This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: