enforce type checking for put_object, encode to utf-8 to match boto3#2
Merged
Conversation
lucasmcdonald3
approved these changes
Aug 13, 2025
Comment on lines
+53
to
+57
| if sz.DEFAULT_ENCODING != DEFAULT_ENCODING: | ||
| raise S3EncryptionClientError( | ||
| f"All Serializers MUST only support utf-8 encoding, but {sz_name} is using " | ||
| f"{sz.DEFAULT_ENCODING}!" | ||
| ) |
There was a problem hiding this comment.
Unit testing this could be annoying due to global module -- maybe have the test inject a new serializer into the module then remove it?
| ) | ||
|
|
||
|
|
||
| def test_unicode_string_roundtrip(): |
There was a problem hiding this comment.
A note that might help you as you progress in writing tests:
For DBESDK RTTs, I liked to test the same input with both a vanilla boto3 client and our encrypted client.
Given the same input, each client should (usually) expect the same output.
Here's how you could set that up:
https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/python-poc/DynamoDbEncryption/runtimes/python/test/integ/encrypted/test_client.py#L75-L105
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
Match how boto3 handles strings in put_object. See boto/boto3#2407 for more details.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.