Skip to content

enforce type checking for put_object, encode to utf-8 to match boto3#2

Merged
kessplas merged 1 commit into
stagingfrom
type-enforce
Aug 15, 2025
Merged

enforce type checking for put_object, encode to utf-8 to match boto3#2
kessplas merged 1 commit into
stagingfrom
type-enforce

Conversation

@kessplas

Copy link
Copy Markdown
Contributor

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.

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}!"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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():

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@kessplas kessplas merged commit 2360ff2 into staging Aug 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants