-
Notifications
You must be signed in to change notification settings - Fork 18
Support draft-directory-04 with sf-dictionary signature-agent #63
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
base: main
Are you sure you want to change the base?
Support draft-directory-04 with sf-dictionary signature-agent #63
Conversation
This commits adds support for sf-dioctionary headers in http-message-sig, and paired signature-agent as a dictionary format. This is made to be backward compatible: old test vectors still pass. The implementation of sf-dictionary is primitive, and likely does not pass all tests for [RFC 8941](https://www.rfc-editor.org/rfc/rfc8941.html). This is acceptable for now. We _could_ publish this as an alpha. The new test vectors are added in thibmeu/http-message-signatures-directory#79, and have a corresponding json [web_bot_auth_architecture_v2.json](./packages/web-bot-auth/test/test_data/web_bot_auth_architecture_v2.json). They can be imported by other implementations.
28a3d83 to
5afdf96
Compare
|
@AkshataDM ping |
AkshatM
left a comment
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.
I think the implementation works, just left a minor comment for supporting more liberal input to the verifier.
| | "keyid" | ||
| | string; | ||
|
|
||
| export interface StructuredFieldComponent { |
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.
The name StructuredDictionaryHeader is clearer about the shape of the component and what it applies to.
| if (value.match(/^".*"$/)) return [key.trim(), value.slice(1, -1)]; | ||
| if (value.match(/^\d+$/)) return [key.trim(), parseInt(value)]; | ||
|
|
||
| // TODO: this is restricted to components array. Per RFC9421, there could be more |
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.
A small comment to clarify value here has shape of an SFV innerlist would help - I didn't realize this was parsing e.g. foo=("a" "b";key="...") for a while.
| toPush = parseInt(item); | ||
| } else if (match[1].includes('";key="')) { | ||
| toPush = { | ||
| key: match[1].split('";key="')[1], |
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.
nit: this works if key is the first parameter on the inner list, and it works for the specific case of "signature-agent";key"...." today because it's the only parameter we require.
But for cases of two or more keys, where order is not fixed, this will break. I think a proper parser of innerlist parameters for incoming requests should handle that.
This commits adds support for sf-dioctionary headers in http-message-sig, and paired signature-agent as a dictionary format.
This is made to be backward compatible: old test vectors still pass.
The implementation of sf-dictionary is primitive, and likely does not pass all tests for RFC 8941.
This is acceptable for now. We could publish this as an alpha.
The new test vectors are added in
thibmeu/http-message-signatures-directory#79, and have a corresponding json
web_bot_auth_architecture_v2.json. They can be imported by other implementations.