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

Update signer v1 example for AOSS #252

Closed
wants to merge 0 commits into from

Conversation

harrisonhjones
Copy link
Contributor

Description

Like #216 but for the v1 signer.

Issues Resolved

I did not open one but could if needed. Originally tried solving it via aws/aws-sdk-go#4761 but this way is more "right".

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.

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.

%v: %v looks like a typo/bug

signer/aws/aws.go Outdated Show resolved Hide resolved
signer/aws/aws.go Outdated Show resolved Hide resolved
signer/aws/aws.go Outdated Show resolved Hide resolved
signer/aws/aws.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@harrisonhjones harrisonhjones left a comment

Choose a reason for hiding this comment

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

Thanks for taking a look @dblock . I'll address you comments asap.

signer/aws/aws.go Outdated Show resolved Hide resolved
signer/aws/aws.go Outdated Show resolved Hide resolved
signer/aws/aws.go Outdated Show resolved Hide resolved
signer/aws/aws.go Outdated Show resolved Hide resolved
@harrisonhjones
Copy link
Contributor Author

@dblock addressed your concerns.

Copy link
Collaborator

@VachaShah VachaShah left a comment

Choose a reason for hiding this comment

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

Thank you @harrisonhjones for adding this!

It would be good to add this to the user guide as well: https://github.com/opensearch-project/opensearch-go/blob/main/USER_GUIDE.md#aws-sdk-v1

@@ -22,54 +24,85 @@ import (
v4 "github.com/aws/aws-sdk-go/aws/signer/v4"
)

// OpenSearchService AWS OpenSearchService Name
// OpenSearchService Amazon OpenSearch Service Name
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could keep it as "Amazon OpenSearch Service" and for L30 as "Amazon OpenSearch Serverless".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am likely misreading your comment but is this not what I'm doing? If not, can you clarify what you are looking for here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also:

  1. Do we want to export these constants? They aren't exported in the v2 signer.
  2. If we do perhaps they should be OpenSearchServiceName and OpenSearchServerlessName to clarify they are Names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could even go further and create a custom Name type and have NewSignerWithService accept a service Name as a param.

Just a few ideas. I'm flexible.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine as is.

// OpenSearchServerless Amazon OpenSearch Serverless Name
const OpenSearchServerless = "aoss"

const emptyBodySHA256 = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can skip the empty body hash since the signer assigns the empty body hash if the request body is null, looking at https://github.com/aws/aws-sdk-go/blob/main/aws/signer/v4/v4.go#L708

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell that's only if includeSHA256Header is true which isn't for aoss, only some s3 services.

dblock
dblock previously approved these changes Mar 21, 2023
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.

I'm good with this! @VachaShah has a good point that the signing code already signs an empty body, so let's avoid doing it twice?

+1 on users guide and CHANGELOG please?

@harrisonhjones
Copy link
Contributor Author

Re-created but using a proper feature branch: #259

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.

3 participants