Signature-Agent parsers accept an http directory member

Abierto
#162 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@KonstantinMirin ya está trabajando en esto.

Desde el 18/10/2026.

  • #163 de @KonstantinMirin — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
rust, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
182
Forks
49
Merge medio
1 d 20 min
PR fusionados (30 d)
19

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cloudflare/web-bot-auth

Todos los issues de cloudflare/web-bot-auth

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.