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

Include request body of multipart/form-data requests into AWS4 signature #1120

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/authorizer/aws4.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,16 @@ var _ = require('lodash'),
return callback(hash.digest(digestEncoding));
}

// @todo: formdata body type requires adding new data to form instead of setting headers for AWS auth.
// @todo: formdata body type for S3 requires adding new data to form instead of setting headers for AWS auth.
// Figure out how to do that. See below link:
// AWS auth with formdata: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html
// For now, sign requests as other POST requests for use with API gateway and Lambda functions.
if (body.mode === RequestBody.MODES.formdata) {
formdataBody = bodyBuilder.formdata(body.formdata).body;
hash.update(formdataBody);

return callback(hash.digest(digestEncoding));
}

// ensure that callback is called if body.mode doesn't match with any of the above modes
return callback();
Expand Down