voltone
Plug for verifying request signatures according to the IETF HTTP signatures draft specification.
Supports the following algorithms:
- “hs2019”, using ECDSA, RSASSA-PSS or HMAC
- “rsa-sha256”, using RSASSA-PKCS1-v1_5
- “ecdsa-sha256”
- “hmac-sha256”
- “rsa-sha1”, using RSASSA-PKCS1-v1_5
Hex: https://hex.pm/packages/plug_signature
Hexdocs: https://hexdocs.pm/plug_signature/
GitHub: https://github.com/voltone/plug_signature
Signing the request body requires use of the HTTP Digest header, which can be added through the following package:
Hex: https://hex.pm/packages/plug_body_digest
Hexdocs: https://hexdocs.pm/plug_body_digest/
GitHub: https://github.com/voltone/plug_body_digest
A very simple sample app using both plugs is available in the PlugSignature GitHub repo. This code also includes two client implementations (one in Elixir using Tesla, and one as a shell script using OpenSSL/cURL) for testing.
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
tangui
Hi Voltone,
Great work! I’m very curious about the use-case it solves, if it’s no secret. I remember having to choose between such a scheme and signed JWT (which transforms the JSON payload to a base64 payload, is heavier, etc.). We finally chose not using this HTTP signature mainly because of a host of proxies that would have inevitably modified some signed headers and lack of implementation.
Also, I see you support RSA with PSS padding. So far I thought it wasn’t supported by Erlang. That’s good news! Thanks for the code and comment that goes with it, I’ll you use it soon
anthonator
From the IETF draft:
It looks like this is similar to how companies like Shopify and GitHub allow you to verify the content of a payload by signing the body of the HTTP request with a private/secret key. I’ve seen this used mostly with webhooks. Apologies if that’s incorrect.
Looks awesome though!
voltone
Leaving aside projects where the use of this standard is prescribed, e.g. due to integration or compliance requirements…
Compared to other authentication mechanisms that work at the HTTP layer, signatures offer a number of benefits:
Compared to authentication at the TLS layer, e.g. a client certificate:
Of course you could implement the whole thing in a higher layer, using HTTP only as a dumb pipe. I generally try to avoid pushing functionality up the stack, preferring to leverage the services of lower layers (in this case HTTP) and handling only my business logic in the application layer. This allows me to delegate things like authentication and authorisation (e.g. to Plugs or API gateways) without impacting my APIs.
As for headers being manipulated between client and server, this hasn’t been an issue for me: headers that are likely to be modified often do not require integrity protection. In earlier versions of the spec the Date header was included in the signature, to limit the signature validity, and this could be problematic (also for AJAX clients), but the latest drafts use the created/expires parameters of the signature header instead.