[bug]: web-bot-auth (TS): verify() rejects signatures covering another label's Signature-Agent member (§5.2.2)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 56/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cryptography, node.js, typescript
Línea de trabajo
Read packages/web-bot-auth/src/index.ts around verifiedSignatureAgent (lines 232–246), then compare its label handling with the cited §5.2.1 and §5.2.2 requirements and the Appendix D.2 example. Reproduce with the supplied script and check the existing test for member keys independent of signature labels. Done means the conformant browser signature verifies while a signature missing a required covered component is rejected.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
verify() rejects every signature that covers more than one keyed Signature-Agent member (signature must cover exactly one signature-agent member). draft-ietf-webbotauth-httpsig-protocol-01 §5.2.2 lets a signer cover another label's fields, and requires it to cover every component of that label's Signature-Input, which includes that label's Signature-Agent member. So a conformant outer signature always covers two keyed members, and verify() always rejects it. Appendix D.2 has exactly this shape.
The signature itself is valid: http-message-sig verifySignature with label: "browser" verifies the same request. The rejection comes from the count check in verifiedSignatureAgent (index.ts L232–L246).
Conversely, removing "signature-agent";key="agent" from the outer signature makes verify() accept it, although §5.2.2 forbids that (the component is listed in "signature-input";key="agent").
Spec
draft-ietf-webbotauth-httpsig-protocol-01, §5.2.1:
Its member keyed to the signature label MUST be signed as a component as defined in Section 2.1 of [HTTP-MESSAGE-SIGNATURES].
§5.2.2:
A signer MAY cover members from another signature label, which preserves evidence that another signer contributed to the request. A signer that covers "signature";key=X MUST also cover "signature-input";key=X, and MUST cover every component identifier listed in "signature-input";key=X.
Appendix D.2 signs browser=("@method" "@authority" "@path" "signature-agent";key="browser" "signature-agent";key="agent" "signature-input";key="agent" "signature";key="agent") and states: "The origin verifies each signature on its own." The same §5.2.2 paragraph and D.2 example are in draft-meunier-webbotauth-httpsig-protocol-01, the revision cited in the package README.
Reproduction
import { generateKeyPairSync, sign as edSign } from "node:crypto";
import { verify } from "web-bot-auth";
import { verifierFromJWK } from "web-bot-auth/crypto";
async function key() {
const { privateKey, publicKey } = generateKeyPairSync("ed25519");
const verifier = await verifierFromJWK(publicKey.export({ format: "jwk" }));
return { verifier, sign: (base) => edSign(null, Buffer.from(base), privateKey).toString("base64") };
}
const agent = await key();
const browser = await key();
const created = 1800000000;
const params = (k, c) =>
`;created=${c};expires=${created + 3600};keyid="${k.verifier.keyid}";alg="ed25519";tag="web-bot-auth"`;
// Shape of draft-ietf-webbotauth-httpsig-protocol-01, Appendix D.2
const agentInput = `("@method" "@authority" "@path" "signature-agent";key="agent")${params(agent, created)}`;
const agentSig = agent.sign(
`"@method": GET\n"@authority": origin.example\n"@path": /resource\n` +
`"signature-agent";key="agent": "https://agent.example"\n"@signature-params": ${agentInput}`
);
const browserInput =
`("@method" "@authority" "@path" "signature-agent";key="browser" "signature-agent";key="agent" ` +
`"signature-input";key="agent" "signature";key="agent")${params(browser, created + 1)}`;
const browserSig = browser.sign(
`"@method": GET\n"@authority": origin.example\n"@path": /resource\n` +
`"signature-agent";key="browser": "https://browser.example"\n` +
`"signature-agent";key="agent": "https://agent.example"\n` +
`"signature-input";key="agent": ${agentInput}\n` +
`"signature";key="agent": :${agentSig}:\n` +
`"@signature-params": ${browserInput}`
);
const request = () =>
new Request("https://origin.example/resource", {
headers: {
"signature-agent": `agent="https://agent.example", browser="https://browser.example"`,
"signature-input": `agent=${agentInput}, browser=${browserInput}`,
signature: `agent=:${agentSig}:, browser=:${browserSig}:`,
},
});
const keys = [agent.verifier, browser.verifier];
const resolver = (c) => keys.find((v) => v.keyid === c.keyid);
const now = new Date((created + 10) * 1000);
for (const label of ["agent", "browser"]) {
try {
const r = await verify(request(), { label, now, resolver });
console.log(label, "-> verified, signatureAgent:", r.signatureAgent.uri);
} catch (e) {
console.log(label, "->", e.message, "|", e.cause?.message);
}
}
Expected:
agent -> verified, signatureAgent: https://agent.example
browser -> verified, signatureAgent: https://browser.example
Actual:
agent -> verified, signatureAgent: https://agent.example
browser -> Verifier resolution failed | signature must cover exactly one signature-agent member
Possible fix
Pass the candidate label to verifiedSignatureAgent. When more than one keyed member is covered, select the one whose key equals the label (§5.2.1), and reject only if none does. The single-member case stays as it is (it also covers relabeling permitted by §6.6.1), so the existing test "authenticates a member key independent from the signature label" keeps passing. This could be part of #171; related to #102 and #193.
Environment
mainat ce5e54fd7e05dd8ae14fd56198cfcba7acb6082e, built withnpm ci && npm run build; npm[email protected]gives the same output- Node.js v22.23.4, macOS
- Lenguaje dominante
- Rust
- Estrellas
- 182
- Forks
- 49
- Merge medio
- 1 d 20 min
- PR fusionados (30 d)
- 19
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cloudflare/web-bot-auth
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
cloudflare/web-bot-auth#203 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cloudflare/web-bot-auth#172 ·
Los mantenedores suelen responder en 1 día
-
Demo verifier rejects the dictionary-form Signature-Agent that draft -01 requires; accepts the legacy formPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
cloudflare/web-bot-auth#199 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 54/100
cloudflare/web-bot-auth#195 ·
Los mantenedores suelen responder en 1 día
-
http-message-sig: trailing "#" in the target URI ends up in @path / @queryPosiblemente ocupada @konippi la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 58/100
cloudflare/web-bot-auth#194 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de cloudflare/web-bot-auth
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
symposium-dev/symposium#530 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
topgrade-rs/topgrade#2540 ·
Los mantenedores suelen responder en 1 día
-
Invalid JSON options for ngram and edge_ngram silently use defaultsPosiblemente ocupada @Tilendlesa la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
noemaforge/vimanam#153 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día