-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Body
Summary
There's an inconsistency between the Rust http-signature-directory validator and the TypeScript directoryResponseHeaders function regarding the ;req component parameter on @authority.
The Issue
Rust validator (http-signature-directory) requires "@authority";req:
// crates/http-signature-directory/src/main.rs lines 72-83
CoveredComponent::Derived(DerivedComponent::Authority { req: true }) => {
vec![self.authority.clone()] // ✓ Returns value
}
CoveredComponent::Derived(DerivedComponent::Authority { req: false }) => {
error!("You are signing a plain `@authority` without the `req` component parameter...");
vec![] // ✗ Returns empty, causing verification failure
}TypeScript library (directoryResponseHeaders) produces "@authority" without ;req:
// packages/http-message-sig/src/directory.ts
export const RESPONSE_COMPONENTS: Component[] = ["@authority"]; // No ;reqCloudflare documentation also shows "@authority" without ;req:
https://developers.cloudflare.com/bots/reference/bot-verification/web-bot-auth/#2-host-a-key-directory
Signature-Input: sig1=("@authority");alg="ed25519";keyid="...";tag="http-message-signatures-directory"...
RFC 9421 Reference
Section 2.4 states:
"When a request message results in a signed response message, the signer can include portions of the request message in the signature base by adding the
reqparameter to the component identifier."
The RFC uses "can" (optional), not "MUST" (required).
Reproduction
- Use
directoryResponseHeadersto sign a directory response - Validate with
http-signature-directoryCLI - Validation fails with:
"You are signing a plain @authority without the req component parameter"
Questions
- Should the TypeScript library be updated to use
"@authority";reqinRESPONSE_COMPONENTS? - Or should the Rust validator be relaxed to accept
"@authority"without;req? - Should the Cloudflare documentation be updated?
Environment
http-signature-directoryv0.6.0web-bot-authv0.1.1