akka / alpakka

Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
https://doc.akka.io/docs/alpakka/current/
Other
1.26k stars 646 forks source link

Implement Amazon's Request-signing Test Suite #98

Open joearasin opened 7 years ago

joearasin commented 7 years ago

I was digging through some of my notes from originally building the S3 functionality and dug this up. Amazon provides a test suite for AWS signature libraries. It might make sense to use it.

http://docs.aws.amazon.com/general/latest/gr/signature-v4-test-suite.html

ktoso commented 7 years ago

That would be great indeed, anyone up for jumping on this task?

devsprint commented 7 years ago

Hi, I've started to implement a new test suite using Amazon provided test suite. First problem that I have found with the current implementation is the missing hash of the payload (hash of empty string) in building Canonical Request. In Canonical Request object: val hashedBody = req.headers.find(_.name == "x-amz-content-sha256") .map(_.value).getOrElse("")

See: Task 1: Create a Canonical Request for Signature Version 4

I'll come with PR tomorrow.

devsprint commented 7 years ago

@joearasin @ktoso implementation is completed. There is only one test that is skipped (you'll see in the code). This is because I did not found a way to build a HttpRequest with body, without having it adding the charset part to content type. If you know a way to do this, then I will update the code in a second.

jrudolph commented 7 years ago

As commented in #120 it is not possible to use the AWS signing test suite verbatim because akka-http cannot be made to render exactly the same requests. This comment gives a few hints how better test coverage could be achieved anyways.