-
Notifications
You must be signed in to change notification settings - Fork 231
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
Remove timestamp validation for requests that use query string authentication #651
Conversation
246b228
to
1e0dff6
Compare
@@ -447,9 +447,6 @@ public final void doHandle(HttpServletRequest baseRequest, | |||
dateSkew = parseIso8601(request.getHeader( | |||
AwsHttpHeaders.DATE)); | |||
} | |||
} else if (request.getParameter("X-Amz-Date") != null) { // v4 query | |||
String dateString = request.getParameter("X-Amz-Date"); | |||
dateSkew = parseIso8601(dateString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a unit test that shows this problem more clearly? This will allow fixing the underlying issue more easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I just saw #648 (comment). I'm trying to understand the intention from AWS -- do the Date
parameters/headers only apply to unauthenticated requests and the Expires
parameters apply to authenticated requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Date Header: Used in both unauthenticated and authenticated requests. For authenticated requests, it's part of the signing process.
-
Expires Parameter: Used for pre-signed URLs to specify how long the URL is valid. It applies to authenticated requests where temporary access is provided.
When using pre-signed URLs in AWS, the Date
header is generally not required as the timestamp and expiration are included in the URL parameters themselves. The crucial components in a pre-signed URL are the Expires
parameter and the signature, which are used to validate the request.
Even if the Date
header is not included, AWS validates the pre-signed URL based on the following:
- Expiration Check:
- AWS checks the current time against the
Expires
parameter in the URL. If the current time is beyond the expiration time specified, the request is denied.
- Signature Verification:
-
AWS verifies that the signature is correct by recalculating the expected signature using the provided parameters (including
Expires
). -
This ensures the URL has not been altered since it was generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, if we use a pre-signed URL with no Date header, but even with Date parameters in the request, we don't need to validate the timestamp, because if we do, we will always get an error when maximumTimeSkew expires, which is 15 minutes by default.
1e0dff6
to
0eab2b1
Compare
Thank you for your contribution @timursaikaliev! Does anything inside of s3-test exercise this that we could enable? |
Relates to #648