Skip to content
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 required header for SigV4 signing #119

Merged
merged 2 commits into from
Feb 13, 2023

Conversation

harshavamsi
Copy link
Collaborator

Description

Fixes missing header for Amazon OpenSearch Serverless

Issues Resolved

List any issues this PR will resolve, e.g. Closes [...].

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
@harshavamsi harshavamsi changed the title Serverless sig v4 Add required header for SigV4 signing Feb 8, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2023

Codecov Report

Merging #119 (0125698) into main (fa650c2) will increase coverage by 0.01%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##               main     #119      +/-   ##
============================================
+ Coverage     23.89%   23.90%   +0.01%     
  Complexity     1936     1936              
============================================
  Files           245      245              
  Lines          6856     6857       +1     
============================================
+ Hits           1638     1639       +1     
  Misses         5218     5218              
Impacted Files Coverage Δ
src/OpenSearch/Handlers/SigV4Handler.php 84.90% <100.00%> (+0.29%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test, users guide and changelog?

shyim
shyim previously approved these changes Feb 8, 2023
@harshavamsi
Copy link
Collaborator Author

@dblock we've already added tests/changelog/user_guide in a prior PR. This just fixes an issue as part of that.

@dblock
Copy link
Member

dblock commented Feb 8, 2023

@dblock we've already added tests/changelog/user_guide in a prior PR. This just fixes an issue as part of that.

I don't think I agree ;)

  1. This code adds a new x-amz-content-sha256, there are no tests that require that this header is present and is correct. If someone removes this header inadvertently in a refactor or because they don't know that it's required by serverless, no tests will fail.
  2. There's no documentation that mentions that this library supports Serverless. So users don't know if it works.
  3. There's no entry in CHANGELOG that says that serverless is now supported. Which is a change.

I'll stay corrected on 2) and 3) which were added in #117, but you want to add this PR to the list still in CHANGELOG.

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
@harshavamsi
Copy link
Collaborator Author

@dblock @shyim this should be good now.

@@ -98,6 +100,7 @@ public function testSignsWithProvidedCredentialsAndService()
$toWrap = function (array $ringRequest) {
$this->assertArrayHasKey('X-Amz-Security-Token', $ringRequest['headers']);
$this->assertSame('baz', $ringRequest['headers']['X-Amz-Security-Token'][0]);
$this->assertArrayHasKey('x-amz-content-sha256', $ringRequest['headers']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could verify the actual value, SHA is always the same for the same body.

@shouze
Copy link

shouze commented Feb 9, 2023

@harshavamsi thank you, using your fork make us able to user Amazon OpensSarch Serverless 🎉

@dblock dblock merged commit dee449f into opensearch-project:main Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants