-
Notifications
You must be signed in to change notification settings - Fork 866
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
Add a functionality to exclude headers during custom signing. #4265
Comments
The method is not present in v2, but the same headers are excluded in a Helper class here - You can write a custom ExecutionInterceptor and use one of the interceptor hooks to remove the headers you need - Can you use ExecutionInterceptors in your use case? |
Thanks for your response. Yes, the default headers are getting excluded using this helper method but we have a use case to exclude some other custom headers during signing. |
Are you sending the requests to a third-party endpoint or to S3? I'm trying to understand how your use case works... if you are removing headers that are not signed, why do you need to remove them before the signature calculation and add them later? |
No, the request is going to S3. We are at Cloudera where the Hadoop S3A connector is used. Adding one example request below. As you can see SignedHeaders doesn't contain all the headers being sent for example referrer. 23/08/14 17:07:45 DEBUG http.wire: http-outgoing-0 >> "GET /?list-type=2&delimiter=%2F&max-keys=2&prefix=mukund%2F&fetch-owner=false HTTP/1.1[\r][\n]" |
A couple of questions more:
|
we attach audit information about the calling operation which is then preserved in the s3 server logs for fielding support calls or other analysis (which jobs trigger throttling, who is doing the most HEAD requests, in a job what are the ranges of a file being read...) https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/auditing.html |
Referer is one example I gave. We don't want to create signatures for each request but rather cache and re-use it. For example, not adding range header in the signature for multiple get requests on the same file, reuse the same signature for multiple get requests. Does this answer your question? Let me know if you have any other. Thanks |
Hi @debora-ito Any update on this? Or do you have any other questions? |
@mukund-thakur Sorry for the long silence. We are still not entirely sure that excluding headers for signing is a feature we'd like to support. I'm going to work on proof of concept using ExecutionInterceptors to see if it satisfy your use case. |
well, this marks a regression from v1. 😞 |
Quick update: we will work on this feature. |
I recently ran into this as well. For anyone who would like a quick workaround you can do something like this for the headers you'd wish to exclude. Note that if you are using S3 there is a different base Signer (AbstractAwsS3V4Signer) used but the concept would be the same.
You can register this custom signer during client creation like so
Note that you can re-write this as an interface decorator rather than extending the Base signer. This would be more flexible and less coupled to SDK internals. |
Thank you for the sample, Andrew! 👋🏻 @shorea Note to all: this path is for advanced use cases, you must implement your own logic to exclude the headers from signing, there's no explicit API in the SDK that provides this feature. Closing the issue. |
|
Describe the feature
In V1 SDK we are overriding this https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/auth/AWS4Signer.java#L537 custom method to achieve this functionality. But there is no similar option in V2 SDK.
Use Case
We use this feature internally in some of our authorization use cases which won't work without this/similar method in V2 SDK.
Proposed Solution
No response
Other Information
No response
Acknowledgements
AWS Java SDK version used
2.19.12
JDK version used
java version "1.8.0_161"
Operating System and version
Mac OS
The text was updated successfully, but these errors were encountered: