-
Notifications
You must be signed in to change notification settings - Fork 9
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
Maturing the API #27
Maturing the API #27
Conversation
7cae1f2
to
8739d7d
Compare
A checklist from the HTTPbis specification (note they only just released an update: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-message-signatures-13) An aspect not currently supported is JWS Algorithm support . It is not currently clear to me how this would be used; it's implied that the algorithm would be defined by a JWK or "other mechanism common to JOSE implementations", as such this may be that there is a JSON Web Key Set (JWKS) available where the key could be found by its keyid (kid) and then validated that way. This is left without any guidance at all, so this kind of implementation will have to stay firmly in the application logic and not within the scope of this library (for now). High level requirements of a HTTP Message Signing Application/Library (see Section 1.4 of spec):
Message components
HTTP Fields
Derived components
Signature parameters
Request-Response binding
Signature base
Creating Signatures
Verifying Signatures
Signature algorithms
Message Signature Headers
Other security measures
|
After going through the specification further and thinking of use cases where multiple signatures may be added to a message, I think that it would be better for the signature verifier to attempt to validate as many signatures as it can. Essentially, every signature with a key that is known to the application should be validated. This is because there are instances where all the signatures (produced by known keys) do need to be verified to ensure complete coverage of trust for the request:
Essentially, different signatures can be covering different parts of the message and to guarantee the message as a whole all those signatures need to be validated. If you just accept the first one you see, you may only be validating the proxy's signature (which only covers 1 or 2 components) and ignoring an invalid signature that attests to cover a more comprehensive list of components. |
f9dfb03
to
6a4a0c5
Compare
41b638d
to
cd4ec88
Compare
Awesome work! |
Hello, thanks for all the work and effort in the implementation of the draft. Could you upload a full example of how to sign and verify a request and response please? |
👋 I've tested this out on the project that @adrianhopebailie is involved with: It only uses httpbis Looking forward to the eventual release. Thanks! |
including request-response binding
I'm going to take this in as is, and then other improvements can come later |
This signifies a substantial re-write of the library to more completely follow the httpbis message signatures specification.
Approach:
There are two main functions,
signMessage()
andverifyMessage()
. Each accepts: a config to dictate some parameters for the signing/verification logic; a message (to be signed); [optionally] a third message (the request to bind to if signing a response and binding is required).Signing Config:
created
orexpires
time if you want your own one.Verifying Config:
This includes full support for:
@query-param
type (which was previously not supported), and header encoding rules.rsa-sha1
signatures (as per the legacy spec).Outstanding items:
url
parameter for incoming requests (perhaps a function that can do this from a rawIncomingMessage
object)Possible future improvements (out of scope of the rewrite):
keyLookup
function - it can throw errors or return null based on the signature params provided.Accept-Signature
support - TheAccept-Signature
header could be used to "automatically" configure signing. By parsing this header we can determine: