Skip to content

Commit

Permalink
Fix: empty body SHA is incorrect.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Mar 26, 2024
1 parent d38bdc1 commit 837cb35
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Deprecated
### Removed
### Fixed
- Fix SigV4 with AWS SDK v1 ([#496](https://github.com/opensearch-project/opensearch-go/pull/496))
### Security

## [3.0.0]
Expand Down
2 changes: 1 addition & 1 deletion signer/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const OpenSearchService = "es"
const OpenSearchServerless = "aoss"

//nolint:gosec // static empty Body
const emptyBodySHA256 = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
const emptyBodySHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

// Signer is an interface that will implement opensearchtransport.Signer
type Signer struct {
Expand Down
2 changes: 1 addition & 1 deletion signer/aws/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestV4Signer(t *testing.T) {
q := req.Header
assert.NotEmpty(t, q.Get("Authorization"))
assert.NotEmpty(t, q.Get("X-Amz-Date"))
assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", q.Get("X-Amz-Content-Sha256"))
assert.Equal(t, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", q.Get("X-Amz-Content-Sha256"))
})

t.Run("sign request success with body", func(t *testing.T) {
Expand Down

0 comments on commit 837cb35

Please sign in to comment.