Introduce HmacAuthed with secured request's content#57
Introduce HmacAuthed with secured request's content#57
Conversation
|
As discussed with @arbus and @JolandaNava , this PR has been changed in the following way: |
|
If that's ok with everyone, we can merge this as experimental and create a new version out of it. There should be no real issue as the previous implementation is still available. If there's any feedback, we can still have PRs changing the experimental implementations. |
576b7aa to
c7dcf3e
Compare
|
@kahlil29 What do you think we should do about this PR? There should be no breaking changes as the previous API is still here. The new proposed API is still experimental, though functional in our project for now. |
|
Hey @michivi |
kahlil29
left a comment
There was a problem hiding this comment.
Thanks for the detailed description that outlines things quite clearly 🚀
|
From my perspective, I wouldn't worry about maintaining an API just for us - we'll adapt our code quick enough! |
|
@ocharles Thanks for that! |
This PR introduces the new Servant combinator
HmacAuthed. It is essentially the same asHmacAuthbut adds the following:HmacAuthignores it and as a consequence doesn't guarantee the integrity of the request)()parameter introduced byHmacAuthused to represent the user.Discussions
To achieve this, an entirely new module is introduced with a specific client
hmacClientand runnerrunHmacClient. The implementation guidelines behind the module were:hmacClientandrunHmacClientare different from the old versions. It also means that to switch to and from the unsecured equivalent (clientandrunClientM), the user only need to rename the function call and add the required parameter.Pros
Caveats
Breaking changes
HostandAccept-EncodingHTTP headers was removed as it was deemed unnecessary, even harmful for the test cases, for the new implementation in the shared module: theHostmay be set by the client and we shouldn't change it and use the existing value for signature. If it's not set, then it should be ok to extract the value from the target URL. As for theAccept-EncodingHTTP header, it doesn't look like a good idea to tell the remote side that we can accept a Gzip encoding if the client didn't say so and if we actually don't (both the client and this library). Perhaps we should drop it off the whitelist of HTTP headers as well: if any intermediate reverse proxy accepts additional encodings, both the client and server shouldn't care about that and see the unharmed body content, no matter what happens in-between. If the client actually supports the Gzip encoding and the library doesn't, that actually doesn't matter as well: this library doesn't need to know that and the Gzip middleware should ensure that the library only sees and authenticates the decoded content with the new workflow.Questions
Accept-Encodingheader?Further actions required