You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using KMS with various AWS resources, it can be undesirable to give a Function (or a State Machine – anything which can take a SAM Policy Template, I guess) blanket kms:Decrypt for a particular key in order to augment, say, AWSSecretsManagerGetSecretValuePolicy, DynamoDBCrudPolicy or the like. Through KMS, IAM has Conditions which can read the encryption context of a particular request, narrowing the scope of the permissions. As an example:
…with the user of the Policy Template also having to add KMSDecryptPolicy to the same resource when the Secret is encrypted with a CMK. These could be combined into one while narrowing the scope of the KMS permissions like this:
- Encrypted-AWSSecretsManagerGetSecretValuePolicy: # This name is very much not a recommendation.SecretArn: !Ref MySecretKeyId: !Ref MyKey
Knowing the context in which the key will be used allows the permissions to be narrowed greatly.
This would also provide ergonomics where it would be silly to provide every possible IAM permission as a separate SAM Policy Template. For example, to publish to an encrypted SNS topic, a Function requires:
kms:Encrypt
kms:GenerateDataKey
sns:Publish
…for only two of which does a SAM Policy Template exist. A template for kms:GenerateDataKey has been requested, but matching the template to the use case would obviate such requests:
…the transformation of which, I hope, is straightforward. (I'm getting tired of doing it by hand. 😝)
Proposal
When I am able, I can go through the existing SAM Policy Templates to audit which would benefit from an "Encrypted" variant. I can then list which kms: permissions such a variant would use, then really dig into the documentation and list the encryption contexts each of those operations accepts. From that point, it's only a matter of plugging them into the document which defines the policy templates.
Oh, and naming. We'd have to decide on naming. Possibly the hardest part.
Things to consider:
[x] The SAM documentation will need to be updated
Additional Details
I wonder if some kind of smart use of Fn::If or its like would allow KeyId to become an optional parameter to the existing templates. Where leaving it out would have the template transform exactly as it does today.
The text was updated successfully, but these errors were encountered:
Describe your idea/feature/enhancement
When using KMS with various AWS resources, it can be undesirable to give a Function (or a State Machine – anything which can take a SAM Policy Template, I guess) blanket
kms:Decrypt
for a particular key in order to augment, say,AWSSecretsManagerGetSecretValuePolicy
,DynamoDBCrudPolicy
or the like. Through KMS, IAM hasCondition
s which can read the encryption context of a particular request, narrowing the scope of the permissions. As an example:…transforms into (effectively):
…with the user of the Policy Template also having to add
KMSDecryptPolicy
to the same resource when the Secret is encrypted with a CMK. These could be combined into one while narrowing the scope of the KMS permissions like this:…transforming into (effectively):
Knowing the context in which the key will be used allows the permissions to be narrowed greatly.
This would also provide ergonomics where it would be silly to provide every possible IAM permission as a separate SAM Policy Template. For example, to publish to an encrypted SNS topic, a Function requires:
kms:Encrypt
kms:GenerateDataKey
sns:Publish
…for only two of which does a SAM Policy Template exist. A template for
kms:GenerateDataKey
has been requested, but matching the template to the use case would obviate such requests:…the transformation of which, I hope, is straightforward. (I'm getting tired of doing it by hand. 😝)
Proposal
When I am able, I can go through the existing SAM Policy Templates to audit which would benefit from an "Encrypted" variant. I can then list which
kms:
permissions such a variant would use, then really dig into the documentation and list the encryption contexts each of those operations accepts. From that point, it's only a matter of plugging them into the document which defines the policy templates.Oh, and naming. We'd have to decide on naming. Possibly the hardest part.
Things to consider:
[x] The SAM documentation will need to be updated
Additional Details
I wonder if some kind of smart use of
Fn::If
or its like would allowKeyId
to become an optional parameter to the existing templates. Where leaving it out would have the template transform exactly as it does today.The text was updated successfully, but these errors were encountered: