aws / aws/aws-encryption-sdk-python

Encrypt throws incorrect error when a CMK within KMSMasterKeyProvider is disabled

未关闭
#142 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
good first issue
主要语言
Python
星标
255
派生
92
平均合并
2 天 17 小时
30 天内合并 PR
2

描述

If a CMK is disabled/deleted within KMSMasterKeyProvider CMKs, the encrypt call throws a couple of errors (below).

> botocore.errorfactory.DisabledException: An error occurred (DisabledException) when calling the Encrypt operation: arn:aws:kms:eu-west-2:xxxxxxx

> aws_encryption_sdk.exceptions.EncryptKeyError: Master Key arn:aws:kms:eu-west-2

```
import aws_encryption_sdk

kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids=[
'arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222',
'arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333'
])
my_plaintext = b'This is some super secret data! Yup, sure is!'

my_ciphertext, encryptor_header = aws_encryption_sdk.encrypt(
source=my_plaintext,
key_provider=kms_key_provider,
encryption_context={
'not really': 'a secret',
'but adds': 'some authentication'
}
)

decrypted_plaintext, decryptor_header = aws_encryption_sdk.decrypt(
source=my_ciphertext,
key_provider=kms_key_provider
)

assert my_plaintext == decrypted_plaintext
assert encryptor_header.encryption_context == decryptor_header.encryption_context
```

贡献指南

打开贡献指南

调研方向

首先,使用 KMSMasterKeyProvider 示例和一个已禁用或已删除的 CMK 重现 encrypt 调用。跟踪 DisabledException 如何变成 EncryptKeyError,然后添加或更新覆盖测试,使加密针对受影响的 CMK 报告适当的错误,而不是显示的两个错误。

由索引模型根据 Issue 内容生成。

评估

技术栈
aws, python
领域
cloud, cryptography, security
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。