-
Notifications
You must be signed in to change notification settings - Fork 8
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
Introduce HmacAuthed with secured request's content #57
base: master
Are you sure you want to change the base?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 asHmacAuth
but adds the following:HmacAuth
ignores it and as a consequence doesn't guarantee the integrity of the request)()
parameter introduced byHmacAuth
used to represent the user.Discussions
To achieve this, an entirely new module is introduced with a specific client
hmacClient
and runnerrunHmacClient
. The implementation guidelines behind the module were:hmacClient
andrunHmacClient
are different from the old versions. It also means that to switch to and from the unsecured equivalent (client
andrunClientM
), the user only need to rename the function call and add the required parameter.Pros
Caveats
Breaking changes
Host
andAccept-Encoding
HTTP headers was removed as it was deemed unnecessary, even harmful for the test cases, for the new implementation in the shared module: theHost
may 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-Encoding
HTTP 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-Encoding
header?Further actions required