Skip to content

Conversation

@thibmeu
Copy link
Collaborator

@thibmeu thibmeu commented Nov 2, 2025

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.

@thibmeu thibmeu requested a review from AkshatM November 2, 2025 15:10
@thibmeu thibmeu self-assigned this Nov 2, 2025
@thibmeu thibmeu added the enhancement New feature or request label Nov 2, 2025
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.
@thibmeu thibmeu force-pushed the update-signature-agent-sf-dictionary branch from 28a3d83 to 5afdf96 Compare November 4, 2025 22:52
@thibmeu
Copy link
Collaborator Author

thibmeu commented Nov 17, 2025

@AkshataDM ping

Copy link
Contributor

@AkshatM AkshatM left a 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 {
Copy link
Contributor

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
Copy link
Contributor

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],
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants