Skip to content

Commit

Permalink
Merge pull request #30 from jimdelois/issues/29-enable-content-sha-he…
Browse files Browse the repository at this point in the history
…ader

Allows an Option to Pull Hashed Body from X-Amz-Content-Sha256 Header
  • Loading branch information
badslug authored May 12, 2022
2 parents 6f14167 + 2f5eccc commit 1189a1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion AWSSignature4DynamicValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ var AWSSignature4DynamicValue = function() {
day = amzDay(now)
daytime = day + 'T' + amzTime(now)
}
var bodyHash = hash256(request.body || '')
var bodyHash = this.use_header_hash
? request.getHeaderByName('x-amz-content-sha256', false)
: hash256(request.body || '')

// Search for other signed headers to include. We will assume any headers that begin with X-Amz-<*> will be included
var headers = {} // The actual headers to sign
Expand Down Expand Up @@ -319,6 +321,7 @@ AWSSignature4DynamicValue.inputs = [
DynamicValueInput('secret', 'AWS Secret Key', 'SecureValue'),
DynamicValueInput('region', 'AWS Region (us-east-1)', 'String'),
DynamicValueInput('service', 'AWS Service (execute-api)', 'String'),
DynamicValueInput('use_header_hash', 'Use X-Amz-Content-Sha256 header?', 'Checkbox', { defaultValue: false }),
]

registerDynamicValueClass(AWSSignature4DynamicValue)
Binary file modified Extension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1189a1d

Please sign in to comment.