Skip to content

fix(web-bot-auth): require https for directory Signature-Agent members - #163

Open
KonstantinMirin wants to merge 3 commits into
cloudflare:mainfrom
KonstantinMirin:fix/signature-agent-https
Open

KonstantinMirin wants to merge 3 commits into
cloudflare:mainfrom
KonstantinMirin:fix/signature-agent-https

Conversation

@KonstantinMirin

@KonstantinMirin KonstantinMirin commented Oct 18, 2026 •

Copy link
Copy Markdown

draft-ietf-webbotauth-httpsig-protocol-00 Section 5.2.1 requires each Signature-Agent member value to be a URI "whose scheme MUST be https", and Section 5.5.1 says "The directory MUST be served over HTTPS". The TypeScript and Rust parsers required https for jwks_uri and cimd, but accepted http for directory, so verify() handed an http origin to the resolver.

This change applies the https check to every discovery type in both parsers. The directory error message changes from "directory Signature-Agent must use http or https" to "directory Signature-Agent must use https", the same form as the jwks_uri and cimd messages.

In the Rust crate, parse_link in WebBotAuthVerifier::parse no longer checks for an http:// prefix. The parser rejects those members first, so that branch was unreachable.

Fixes #162.

Tests

  • packages/web-bot-auth: 53 passed on Node 24 and Node 26. The parser tests cover an http member in the dictionary form, the type=directory form, the legacy String form, and the jwks_uri and cimd types. A verify() test checks that the resolver is not called for an http directory member.
  • crates/web-bot-auth: 42 passed, with Rust 1.95 because sfv 0.16 requires it. Every test-rust step in pullrequest.yml passes, including the wasm32-unknown-unknown build, clippy -D warnings, rustfmt, and cargo doc.
  • npm run lint (prettier --check and oxlint) is clean, and the other workspaces' tests pass: http-message-sig 35, jsonwebkey-thumbprint 2, and verification-workers 22.

Without the source change, the four directory tests in TypeScript and the Rust test fail. The jwks_uri and cimd cases pass either way: they check that the shared branch still rejects those types.

Compatibility

sign() and verify() throw for an http directory member, including a legacy String Signature-Agent. Nothing in the repository's examples, bench fixtures, or test vectors uses one.

draft-ietf-webbotauth-httpsig-protocol-00 Section 5.2.1 requires each
Signature-Agent member value to be a URI "whose scheme MUST be https", and
Section 5.5.1 says "The directory MUST be served over HTTPS". The TypeScript
and Rust parsers required https for jwks_uri and cimd but accepted http for
directory, so verify() handed an http origin to the resolver.

Apply the https check to every discovery type in both parsers.
…ent tests

The https check is one branch for every discovery type, but the tests
exercised only directory members. Add jwks_uri and cimd members with http
URIs to the TypeScript and Rust tests, and assert the type-specific error
message for each.
parse_signature_agent_header rejects every member that does not use https,
so parse_link never receives an http URI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant