Signature-Agent parsers accept an http directory member

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

I maintainer di solito rispondono entro 1 giorno

@KonstantinMirin ci sta già lavorando.

Dal 18/10/2026.

  • #163 di @KonstantinMirin — aperta

Valutazione

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

Direzione di ricerca

Read packages/web-bot-auth/src/registry.ts and crates/web-bot-auth/src/registry.rs, starting at validateDiscoveryURI and validate_discovery_uri; compare the directory handling with the existing jwks_uri and cimd checks. Review the open PR #163 and its tests for the dictionary, type=directory, and legacy String forms. Done means all discovery forms enforce the stated HTTPS rule and their tests pass.

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

Descrizione

parseSignatureAgentHeader in packages/web-bot-auth/src/registry.ts and parse_signature_agent_header in crates/web-bot-auth/src/registry.rs accept a directory member whose value uses the http scheme. Both parsers require https for jwks_uri and cimd. verify() passes the http member to the resolver as candidate.signatureAgent, and returns it as the verified signatureAgent.

draft-ietf-webbotauth-httpsig-protocol-00 requires https for every member:

  • Section 5.2.1: "Its member values MUST be String Items that contain a [URI], whose scheme MUST be https."
  • Section 5.5.1: "The directory MUST be served over HTTPS."

The editor's copy keeps the Section 5.2.1 sentence. The parsers landed in #92 in June 2026, and the https rule first appeared in draft-meunier-webbotauth-httpsig-protocol-01 in August, so the parsers may predate the rule rather than allow http on purpose.

Reproduction

With web-bot-auth 0.2.0 and http-message-sig 0.3.0 from npm:

import { component, createSignature } from "http-message-sig";
import { parseSignatureAgentHeader, verify } from "web-bot-auth";
import { signerFromJWK, verifierFromJWK } from "web-bot-auth/crypto";

parseSignatureAgentHeader('sig1="http://signature-agent.test"');
// {"kind":"current","entries":[{"label":"sig1","uri":"http://signature-agent.test","type":"directory"}]}

// RFC 9421 Appendix B.1.4 test key
const key = {
  kty: "OKP",
  crv: "Ed25519",
  d: "n4Ni-HpISpVObnQMW0wOhCKROaIKqKtW_2ZYb2p9KcU",
  x: "JrQLj5P_89iXES9-vFgrIy29clF9CC_oPPsw3c5D0bs",
};
const signer = await signerFromJWK(key);
const verifier = await verifierFromJWK(key);
const now = Math.floor(Date.now() / 1000);
const request = new Request("https://example.com/", {
  headers: { "Signature-Agent": 'sig1="http://signature-agent.test"' },
});
const fields = await createSignature(request, {
  label: "sig1",
  components: ["@authority", component("signature-agent", { key: "sig1" })],
  parameters: { created: now, expires: now + 300, keyid: signer.keyid, alg: "ed25519", tag: "web-bot-auth" },
  signer,
});
request.headers.set("Signature", fields.signature);
request.headers.set("Signature-Input", fields.signatureInput);
const result = await verify(request, { resolver: () => verifier });
result.signatureAgent.uri; // "http://signature-agent.test"

A resolver that fetches the directory named in candidate.signatureAgent fetches it over http. The verification worker example does this in fetchDirectory.

Proposed change

Apply the https check that the parsers make for jwks_uri and cimd to every discovery type. I have a PR ready that changes validateDiscoveryURI and validate_discovery_uri, and adds tests for the dictionary form, the type=directory form, and the legacy String form.

A caller that signs or verifies against a local http directory then gets an error from sign() and verify(). If local development needs http, an explicit option could cover it.

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.