-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
s3 generated_presigned_url ignores IfNoneMatch #4367
Comments
For reference, I am able to get this to work correctly with botocore. So this is a bug in boto3 itself. session = boto3.session.Session()
req = botocore.awsrequest.AWSRequest(
method="PUT",
url="https://<bucket>.s3.amazonaws.com/<filename>",
data={},
params={
"If-None-Match": "*",
},
headers={},
)
botocore.auth.S3SigV4QueryAuth(session.get_credentials(), "s3", "us-east-1").add_auth(req)
print(req.url) |
Hello @rittneje, thanks for reaching out. From the error snippet, it looks like SigV2 is being used. From my replication, I was able to get SigV4 that would contain AWS4-HMAC-SHA256 (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) like https://bucket-name.s3.us-east-2.amazonaws.com/test?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXXXXXXX%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20241XXXXXZ&X-Amz-Expires=360&X-Amz-SignedHeaders=host%3Bif-none-match&X-Amz-Signature=0f8af1XXXXX89c800c0d . |
Hi @rittneje, just a small addition to my previous response. You can set Config(signature_version="s3v4") to have Sig V4 https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html. If you have any questions, please let me know. Thanks. |
@adev-code Your reference says:
So SigV4 is supposed to be the default. Why is it defaulting to SigV2? In addition, even if I explicitly request SigV4, it still doesn't include the value for |
Describe the bug
I created a presigned S3 upload URL like so:
However, the
IfNoneMatch
is not reflected in the resulting presigned URL at all. Attempting to use it when the file in question already exists does NOT result in an error. And if I manually specify theIf-None-Match
header when I do the upload, it fails with the following error message:Regression Issue
Expected Behavior
Specifying
IfNoneMatch
needs to be reflected in the presigned URL and honored by the resulting upload.The user of the presigned URL should not need to specify the
If-None-Match
header as this defeats the whole point.Current Behavior
See above.
Reproduction Steps
See above.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.35.74
Environment details (OS name and version, etc.)
n/a
The text was updated successfully, but these errors were encountered: