-
Notifications
You must be signed in to change notification settings - Fork 3
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
Separate tests for Signature and Authorization headers #8
Comments
I think I can handle this by adding a new option to the binary maybe
Our existing project should be able to handle it. |
I noticed some "sign" tests pass in an incomplete header, expecting the implementation to parse and correct it. I don't see the utility here - in general a library will simply receive a command to sign/authorise and make the entire header. What real-world scenario are we reflecting here where a signer would start with an incomplete header? Surely we should just pass in the instruction "sign this message in this header with this keyid..." rather than expecting them to first parse a bad header - something the library is designed to reject anyway? Otherwise there's a lot of work an implementer needs to do to parse the input just to pass the test... As for not impacting the opposite header, it doesn't even need to be valid under this spec, just that 1) it exists and has a value, and 2) the implementation spits it out exactly as was provided... |
Could you link me to one of the HTTP messages with an incomplete header? I will definitely correct any HTTP Messages with invalid headers. |
As of 947cdc6, for this invocation:
The generator receives the following on stdin:
Since the |
This is invalid because authorization is lower case (which I am going to correct) or another reason? p.s. commit for capitalizing Authorization is here: 616dd63 Was anything else invalid because obviously the binary I'm using is parsing the message just fine. |
According to HTTP spec, headers are not case-sensitive. If anything varying the case in tests add robustness - a lowercase
In terms of the test case, yes.
Essentially: Why are you feeding |
|
Ah, I see the confusion.
Dereferencing isn't possible most times, as the value may have no relation to the key value. A missing |
thanks so much for this issue I have removed the Authorization header entirely from the sign tests, added keyId to the parameters passed to sign, and also refactored to cut down on the number of httpMessages used in the tests. Let me know if I can close this unless you feel we still need an Authorization/ Signature toggle. oh wait I'm sorry we have not gotten to the verify tests yet so let me go through them. Sorry man a little under the weather today. |
Definitely still need the toggle. There are production APIs today that need a correct |
what would make more sense for the name of the option:
I prefer construct. |
Tried seeing if the spec has clarity, but it actually treats the two modes as different worlds with hardly any language in common. "mode" is already taken to indicate canon/sign/verify (at least I've proposed it in (#14) so that would only be confusing, and "header" is too similar to "headers". I think "construct" is reasonable. Let me know when it's implemented and I'll see if I can write up the instructions in the README if you'd like. |
@msporny has suggested
|
At present all
sign
andverify
commands seem to operate only on theAuthorization
header. In practise this header is usually only used for authentication, whileSignature
implies content protection as spelled out in v11. Indeed a resource may require anAuthorization: Bearer
to be preserved while the request is signed withSignature
(APIs exist today with this requirement), or useAuthorization: Signature
to authorise a request containing content protected by aSignature
from another party.This suite should include:
sign
modes for each headerverify
modes for each header (including not failing on non-signatureAuthorization
header being present)sign
action does not affectAuthorization
header, and vice versa.The text was updated successfully, but these errors were encountered: