-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
X-Amz-Content-SHA256 should be present when querying Amazon OpenSearch Serverless #1067
Comments
Hi there and welcome to this repository! A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it. |
Hi @JCKortlang and thank you for the detailed issue! I'll try to build the environment and reproduce the error. |
@FantasticFiasco before you do. I'm engaging with the AOSS team and the issue appears to be caused by a signed 'x-forwarded-for' header and not the absence of the documented content header. Unclear if the documented required header is actually required. May be worth adding if it doesn't break existing behavior. |
I'm happy that you're in contact with the responsible team! Let's give you the time to clarify the issue with the team, and once you're satisfied with their requirements, we'll implement them here. |
I love when you have a weird issue and you find a GitHub issue updated in the past day 😄 I had the same issue, I think AWS support might be steering you down the wrong path @JCKortlang because I'm also having this issue in C# with a Vector Search Collection in Amazon OpenSearch Serverless. Interestingly, I also get this issue using Amazon's own OpenSearch.Net/OpenSearch.Client, which made me jump over to AwsSignatureVersion4 in the first place. Making the exact change recommended by @JCKortlang solved the problem for me. Specifically on line 138 of SIgner.cs: request.AddHeaderIf(serviceName == ServiceName.S3, HeaderKeys.XAmzContentSha256Header, contentHash); was changed to: request.AddHeaderIf(serviceName == ServiceName.S3 || serviceName == ServiceName.OpenSearchServerless , HeaderKeys.XAmzContentSha256Header, contentHash); And a corresponding entry was added to ServiceName: internal const string OpenSearchServerless = "aoss"; And just like that, my searches started working :) |
For visibility, the issue with
Mitigation: Don't forward -- Based on the feedback from @95horatio looks like the adding of |
Fixes #1067 * fix: add x-amz-content-sha256 header when targeting opensearch serverless * docs(changelog): update
v4.0.5 is now released on nuget.org. Thanks for reporting the issue! |
And I almost forgot, thanks for the excellent breakdown of the problem and the fix! |
Describe the bug
Update: Issue described below with the VPCE is due to the VPCE mutating a signed header.
X-Amz-Content-SHA256
header is still a relevant issue but not the one described below.Only reproducible when querying an Amazon OpenSearchServerless collection with a private network policy (accessibly only via VPCE). I am unable to reproduce on a collection with a public network policy.
--
Based on the documentation,
https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-clients.html#serverless-signing
Expected Behavior
X-Amz-Content-SHA256 should be present when service identifier is 'aoss'
Current Behavior
X-Amz-Content-SHA256 is not present when querying Amazon OpenSearch Serverless
Reproduction Steps
Infra
Client -> APIG -> Lambda -> VPCE -> AOSS (private)
Via the APIGateway Service Console:
Via the Lambda Service Console:
Via the OpenSearch Service Console:
Sample Lambda Code
Possible Solution
Update https://github.com/FantasticFiasco/aws-signature-version-4/blob/master/src/Private/Signer.cs#L138
Additional Information/Context
Context
I am attempting to proxy requests through API Gateway to our private AOSS collection via VPCE.
Infra
Client -> APIG -> Lambda -> VPCE -> AOSS
Security
1. Allows Task Ingress / Egress
2. Allows Lambda Ingress / Egress
3. Allows AOSS Ingress / Egress
AWS .NET SDK and/or Package version used
3.7.303.38
Targeted .NET Platform
.NET 8
Operating System and version
MacOS 13.6.1 (22G313), Amazon Linux
The text was updated successfully, but these errors were encountered: