Let verify() callers require coverage before key lookup, and export the strict field parser

Aperta
#165 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cryptography, typescript

Direzione di ricerca

Read verify() and VerifyOptions, then follow assertPolicyCoverage and resolveVerifier to see where policy fields are passed. For the parser request, inspect parseStrictDictionary in core.ts and its existing SignatureError codes. Done means both option fields reach the pre-resolver checks, with required parameters retaining the Web Bot Auth minimum, and callers can import the strict parser; the issue says both changes already have separate PRs and tests.

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

Descrizione

This issue has two small requests. Both let a caller of web-bot-auth or http-message-sig apply the checks the library already has, at the point the library already applies them.

verify() cannot require more coverage before the resolver runs

verify() builds the http-message-sig policy itself:

requiredComponents: [],
requiredParameters: ["created", "expires", "keyid", "alg", "tag"],

The resolver receives keyid, algorithm, and signatureAgent, but not the covered components or the parameters. A deployment that needs more than the Web Bot Auth minimum, such as @method and content-digest coverage, or a nonce, can check it only in validate. validate runs after the resolver has fetched key material and after the signature check. Every request that fails such a rule still costs a directory fetch, and the directory fetch is the step that Section 6.7 of draft-ietf-webbotauth-httpsig-protocol-00 treats as an SSRF and resource risk.

http-message-sig already checks requiredComponents and requiredParameters in assertPolicyCoverage, before resolveVerifier. The request is to expose those two fields on VerifyOptions and pass them through. In this proposal, requiredParameters adds to the five Web Bot Auth parameters and can't remove one.

Callers that read Signature-Input need a second tokenizer

verifySignature refuses duplicate member keys, duplicate parameters, and RFC 9651-only values in Signature and Signature-Input, through parseStrictDictionary in core.ts. RFC 8941 parsers, including structured-headers, keep the last instance of a duplicate key instead.

A caller that reads Signature-Input before verification needs the same rules, or the caller and verifySignature disagree about which header is malformed. For example, the caller might read it to pick a label, to route a request to one of several profiles, or to answer 400 before any key lookup. Today that means a hand-written duplicate-key tokenizer. The AdCP TypeScript SDK carries two for this reason.

The request is to export parseStrictDictionary, with the SignatureError codes it already throws.

Interaction with #122

If web-bot-auth moves to fetch-message-signatures, the first request still applies to the policy object verify() builds, and the second request moves to the Structured Fields parser that fetch-message-signatures exports. I can rebase either change onto
#122.

I have both changes ready as separate PRs, with tests.

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.