S3 client is created with the wrong signature version #3067
Labels
bug
This issue is a confirmed bug.
documentation
This is a problem with documentation.
p2
This is a standard priority issue
s3
Describe the bug
S3 client is created with an old signature version that technically works but causes unexpected behavior in S3 particularly in the expiration.
Expected Behavior
S3 client should be created with the s3 signature version 4,
s3v4
Current Behavior
S3 client is created with an old signature version that technically works but causes unexpected behavior in S3 particularly in the expiration.
Reproduction Steps
s3 = boto3.resource('s3')
params = { 'Bucket': 'my-bucket', 'Key': 'my/key/prefix' }
client.generate_presigned_url('get_object', Params=params, ExpiresIn=604800)
The resulting URL will have an
Expires
parameter that has the appearance of correctness, but weird behavior happens in S3 and it has some really unexpected expiration behavior. Attempting to specify 7 days got me 6 or 7 hours.Expires=1700824144 (looks like 7 days from now)
If you specify the signature_version
s3v4
the URL is completely different and looks more appropriate.X-Amz-Algorithm=AWS4-HMAC-SHA256
X-Amz-Expires=604800
Possible Solution
create the client with
s3v4
signature version by default for later versions.Additional Information/Context
No response
SDK version used
botocore==1.31.85
Environment details (OS name and version, etc.)
Mac OS 13.4.1
The text was updated successfully, but these errors were encountered: