Closed
Description
A customer reported issues with an EncryptedPaginator
failing to decrypt when using the AWS KMS crypto materials manager.
In digging into this, I realized that we also do not test for this at all...
I have duplicated this issue by adding paginator tests to the integration test suite.
The issue appears to be that the KMS encryption context is correctly including the hash and sort attribute names on ecrypt, but not on decrypt.
This appears to affect both the scan
and query
paginators.
...
DEBUG botocore.endpoint:endpoint.py:101 Making request for OperationModel(name=GenerateDataKey) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'X-Amz-Target': 'TrentService.GenerateDataKey', 'Content-Type': 'application/x-amz-json-1.1', 'User-Agent': 'Boto3/1.9.216 Python/3.7.0 Darwin/16.7.0 Botocore/1.12.216 DynamodbEncryptionSdkPython/1.1.0'}, 'body': b'{"KeyId": "arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f", "NumberOfBytes": 32, "EncryptionContext": {"*amzn-ddb-env-alg*": "AES/256", "*amzn-ddb-sig-alg*": "HmacSHA256/256", "partition_attribute": "test_value", "sort_attribute": "2231.0001", "*aws-kms-table*": "DDBEC-test-resources-TestTable-HS6VNXM82B6J"}}', 'url': 'https://kms.us-west-2.amazonaws.com/', 'context': {'client_region': 'us-west-2', 'client_config': <botocore.config.Config object at 0x1111ffb38>, 'has_streaming_input': False, 'auth_type': None}}
...
DEBUG botocore.endpoint:endpoint.py:101 Making request for OperationModel(name=Decrypt) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'X-Amz-Target': 'TrentService.Decrypt', 'Content-Type': 'application/x-amz-json-1.1', 'User-Agent': 'Boto3/1.9.216 Python/3.7.0 Darwin/16.7.0 Botocore/1.12.216 DynamodbEncryptionSdkPython/1.1.0'}, 'body': b'{"CiphertextBlob": "AQEBAHhA84wnXjEJdBbBBylRUFcZZK2j7xwh6UyLoL28nQ+0FAAAAH4wfAYJKoZIhvcNAQcGoG8wbQIBADBoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDWTPzuaYLFaMum2QQIBEIA7FsxQ6CVMg66d3RKRXgfSvDOpLnLWZc/6qaPhLYhs7nU9l8Z7ROgvqCNg3lGEYc4VYegUKv285/y0xFU=", "EncryptionContext": {"*amzn-ddb-env-alg*": "AES/256", "*amzn-ddb-sig-alg*": "HmacSHA256/256", "*aws-kms-table*": "DDBEC-test-resources-TestTable-HS6VNXM82B6J"}}', 'url': 'https://kms.us-west-2.amazonaws.com/', 'context': {'client_region': 'us-west-2', 'client_config': <botocore.config.Config object at 0x1111ffb38>, 'has_streaming_input': False, 'auth_type': None}}