boto / boto3

AWS SDK for Python
https://aws.amazon.com/sdk-for-python/
Apache License 2.0
8.81k stars 1.84k forks source link

Boto3 Cognito client should not validate ClientMetaData values in API Calls #4170

Open mariasekartrimble opened 1 week ago

mariasekartrimble commented 1 week ago

Describe the bug

Cognito supports passing additional data to its triggers via an attribute called "ClientMetaData". As per the Cognito doc, it should not be validated/stored/encrypted so the same should be done by Boto3 as well. But that's not done by the boto3 Cognito client. Due to that if the application removes triggers at a later point in time due to some business use cases and still passes the "ClientMetaData" to Cognito APIs it should not validate or parse those, instead, it should leave it as it is like Cognito does. As of now, we are facing some validation issues raised by boto3 like "ParameterValidation" exception It's because of the boto3 validation against the "ClientMetaData" values.

Expected Behavior

The ClientMetaData attribute should not be validated.

Current Behavior

The ClientMetaData is validated.

Reproduction Steps

Just add client meta data with some key value pairs. The value with None.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.26.69

Environment details (OS name and version, etc.)

AWS Lambda

tim-finnigan commented 1 week ago

Thanks for reaching out. The ParameterValidation errors often occur when an older version of the SDK is used. Have you tried updating your version of Boto3? If you using Lambda you can use the default version included in the Python runtimes or package your own.

The CognitoIdentityProvider commands involve calls to underlying service APIs provided by Cognito. In the service API model (which is used across AWS SDKs) I see 15 occurrences of ClientMetadata. There is client-side validation for parameters but the underlying logic is handled in the service API.

If you're still seeing an issue after updating, can you provide a code snippet for us to try and reproduce it? Also, could you share debug logs (with any sensitive info redacted) by adding boto3.set_stream_logger('') to your script?

mariasekartrimble commented 1 week ago

Hello Tim, Thanks for your reply. We haven't tried out the latest version. Will try it out and let you know if there is further issues with that too. Thanks for your response and suggestions.

Thanks for your Time, Sekar.