Skip to content

Inconsistency: Rust validator requires ;req on @authority but TypeScript library doesn't produce it #69

@ulziibay-kernel

Description

@ulziibay-kernel

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 ;req

Cloudflare 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 req parameter to the component identifier."

The RFC uses "can" (optional), not "MUST" (required).

Reproduction

  1. Use directoryResponseHeaders to sign a directory response
  2. Validate with http-signature-directory CLI
  3. Validation fails with: "You are signing a plain @authority without the req component parameter"

Questions

  1. Should the TypeScript library be updated to use "@authority";req in RESPONSE_COMPONENTS?
  2. Or should the Rust validator be relaxed to accept "@authority" without ;req?
  3. Should the Cloudflare documentation be updated?

Environment

  • http-signature-directory v0.6.0
  • web-bot-auth v0.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions