[bug]: Rust signing example signs the whole Signature-Agent member, so the TypeScript verifier rejects it

Aperta
#195 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, typescript

Direzione di ricerca

Start with examples/rust/signing.rs and examples/rust/verify.rs, then read the referenced RFC 9421 Section 2.1.2 and the SignedMessage::lookup_component and UnsignedMessage::fetch_components_to_cover documentation. Run cargo run -p rust-examples --bin signing and verify its output with the TypeScript verifier. Done when the Rust examples use the keyed member value consistently and the signing output verifies.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

examples/rust/signing.rs covers "signature-agent";key="sig1" but supplies the whole member, sig1="https://myexample.com/.well-known/http-message-signatures-directory", as the component value. RFC 9421 Section 2.1.2 defines the value of a key component as the member's value alone, without the key. So the signature base the example builds differs from the one a conforming verifier builds, and the TypeScript verifier in this repo rejects the example's output.

Issue type

  • A library does not implement the Web Bot Auth specification faithfully
  • A provided example does not work
  • A vulnerability is present

Affected component

  • An example under examples/: examples/rust/signing.rs, examples/rust/verify.rs

Environment

  • Crate/package version: main at 01c0d10 (v0.8.0)
  • Toolchain: rustc 1.99.1, Node.js 22.23.3
  • Runtime: native
  • Link to affected code or repository: examples/rust/signing.rs

Reproduction

  1. cargo run -p rust-examples --bin signing and take the printed Signature-Input and Signature.
  2. Pass them, with Signature-Agent: sig1="https://myexample.com/.well-known/http-message-signatures-directory", @authority example.com and the example's Ed25519 public key, to verify() from packages/web-bot-auth.

Expected behaviour: verifies. Section 5.2.1 of the protocol draft requires signing the Signature-Agent member keyed to the label, and RFC 9421 Section 2.1.2 puts the member value "https://myexample.com/.well-known/http-message-signatures-directory" in the signature base.

Actual behaviour: VerificationFailed: Signature verification failed.

examples/rust/verify.rs uses the same whole-member convention (agent1="https://myexample.com") for its lookup, so it accepts signatures built this way.

Test output

cargo +stable test --workspace --all-features --all-targets passes at 01c0d10 (56 passed); the examples are not covered by tests.

Proposed fix

Examples and docs only, no library change: sign the member value in signing.rs, return the member value for the keyed component in verify.rs (with a signature regenerated to match), and note the Section 2.1.2 rule on SignedMessage::lookup_component and UnsignedMessage::fetch_components_to_cover. With that change, the signing example's output passes the TypeScript verifier. I have it ready and can open a PR if you want it.

Checklist

  • I have read CONTRIBUTING.md and confirmed this is an accepted issue form.
  • This is not an interop issue. (The example deviates from RFC 9421 Section 2.1.2; the TypeScript result is the evidence, not the claim.)
Lingua principale
Rust
Stelle
182
Fork
49
Merge medio
1g 20m
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudflare/web-bot-auth

Tutte le issue di cloudflare/web-bot-auth

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.