From e313cee1ae07125fec2e7781c0455dcf5f924ec9 Mon Sep 17 00:00:00 2001
From: Tejaswi Suresh
Date: Sun, 22 Nov 2026 14:57:20 +0100
Subject: [PATCH 1/2] test(verification-workers): replay draft Ed25519
Signature-Agent vectors
Every existing /v0/api/verify test signs with this repo's own sign(), so
a signature base that sign() and verify() build the same wrong way still
passes. The deployed demo shows this today: it builds the base line for
"signature-agent";key="sig1" from the whole field value instead of the
member value, and rejects draft -01 clients (#199).
Replay the fixed E.2.1 (dictionary) and E.2.2 (legacy) vectors from
draft-ietf-webbotauth-httpsig-protocol-01 through the worker. Both pass
on main. Reintroducing whole-field extraction in http-message-sig makes
the E.2.1 case fail while all 33 existing tests still pass.
Also point the landing page at the IETF draft and say which
Signature-Agent forms it accepts.
Refs #199
---
.../verification-workers/src/index-html.ts | 3 +-
.../verification-workers/test/index.spec.ts | 51 +++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/examples/verification-workers/src/index-html.ts b/examples/verification-workers/src/index-html.ts
index 6931e22..6a88999 100644
--- a/examples/verification-workers/src/index-html.ts
+++ b/examples/verification-workers/src/index-html.ts
@@ -223,7 +223,8 @@ const generateHTML = (status?: boolean) => `
HTTP Message Signatures are a mechanism to create, encode, and verify signatures over components of an HTTP message.
They are standardised by the IETF in RFC 9421.
- This website validates the presence of such signature as defined in draft-meunier-webbotauth-httpsig-protocol.
+ This website validates the presence of such signature as defined in draft-ietf-webbotauth-httpsig-protocol.
+ It accepts the dictionary form of the Signature-Agent header, and the legacy string form for migration.
This website checks for an Ed25519 signature on incoming request. They should be signed by a test public key defined in Appendix B.1.4 of RFC 9421.
diff --git a/examples/verification-workers/test/index.spec.ts b/examples/verification-workers/test/index.spec.ts
index 4186574..155ada4 100644
--- a/examples/verification-workers/test/index.spec.ts
+++ b/examples/verification-workers/test/index.spec.ts
@@ -73,6 +73,7 @@ async function fetchValidator(body: Record): Promise {
afterEach(() => {
vi.unstubAllGlobals();
vi.restoreAllMocks();
+ vi.useRealTimers();
});
describe("/ endpoint", () => {
@@ -273,6 +274,56 @@ describe("/v0/api/verify endpoint", () => {
);
});
+ // Ed25519 vectors from draft-ietf-webbotauth-httpsig-protocol-01,
+ // Appendix E.2.1 (dictionary Signature-Agent) and E.2.2 (legacy sf-string).
+ // They are signed outside this repo, so they catch a signature base that
+ // sign() and verify() would otherwise agree on.
+ it.each([
+ {
+ name: "dictionary Signature-Agent (E.2.1)",
+ agent: 'sig2="https://signature-agent.test"',
+ input:
+ 'sig2=("@authority" "signature-agent";key="sig2");created=1735689600;keyid="poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U";alg="ed25519";expires=4889289600;nonce="n9p433xm+NJ3ph3upfBIGmsuwHw387YV7Q/F+6BSpGCVjYCqQw6rznNA8PVVLySrAWsv0hQtFioQb6E1YsauiA==";tag="web-bot-auth"',
+ signature:
+ "sig2=:CGokAoY/FrPpyuzTe1Fb2kLTAH9Idw6qSFd1+D77r1firsMRCxeuLu5e6O+ek3zQgDMAzjiXtLVfqE00xnABCQ==:",
+ },
+ {
+ name: "legacy Signature-Agent (E.2.2)",
+ agent: '"https://signature-agent.test"',
+ input:
+ 'sig2=("@authority" "signature-agent");created=1735689600;keyid="poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U";alg="ed25519";expires=1735693200;nonce="e8N7S2MFd/qrd6T2R3tdfAuuANngKI7LFtKYI/vowzk4lAZYadIX6wW25MwG7DCT9RUKAJ0qVkU0mEeLElW1qg==";tag="web-bot-auth"',
+ signature:
+ "sig2=:jdq0SqOwHdyHr9+r5jw3iYZH6aNGKijYp/EstF4RQTQdi5N5YYKrD+mCT1HA1nZDsi6nJKuHxUi/5Syp3rLWBA==:",
+ },
+ ])("accepts the draft $name vector", async ({ agent, input, signature }) => {
+ vi.useFakeTimers({ toFake: ["Date"] });
+ vi.setSystemTime(new Date("2025-01-01T00:01:00Z"));
+ const uri =
+ "https://signature-agent.test/.well-known/http-message-signatures-directory";
+ const directory = await worker.fetch(
+ new IncomingRequest(uri),
+ env,
+ createExecutionContext()
+ );
+ const fetch = vi.fn(async () => directory.clone());
+ vi.stubGlobal("fetch", fetch);
+
+ const request = new IncomingRequest(`${sampleURL}/v0/api/verify`, {
+ headers: {
+ "Signature-Agent": agent,
+ "Signature-Input": input,
+ Signature: signature,
+ },
+ });
+ const response = await worker.fetch(request, env, createExecutionContext());
+
+ expect(await response.text()).toBe("valid");
+ expect(fetch).toHaveBeenCalledWith(
+ uri,
+ expect.objectContaining({ redirect: "manual" })
+ );
+ });
+
it("rejects a well-known JWK whose kid is not its thumbprint", async () => {
const uri = `${signatureAgentOrigin}/.well-known/http-message-signatures-directory`;
const request = new IncomingRequest(`${sampleURL}/v0/api/verify`, {
From 463dc5ceb37d21bb5b476bff360547be3205283e Mon Sep 17 00:00:00 2001
From: Thibault Meunier
Date: Wed, 25 Nov 2026 09:41:41 +0100
Subject: [PATCH 2/2] test(verification-workers): import published draft
vectors
---
...t-ietf-webbotauth-httpsig-protocol-01.json | 14 ++++++++++
.../verification-workers/test/index.spec.ts | 26 ++++---------------
2 files changed, 19 insertions(+), 21 deletions(-)
create mode 100644 examples/verification-workers/test/draft-ietf-webbotauth-httpsig-protocol-01.json
diff --git a/examples/verification-workers/test/draft-ietf-webbotauth-httpsig-protocol-01.json b/examples/verification-workers/test/draft-ietf-webbotauth-httpsig-protocol-01.json
new file mode 100644
index 0000000..9c2224f
--- /dev/null
+++ b/examples/verification-workers/test/draft-ietf-webbotauth-httpsig-protocol-01.json
@@ -0,0 +1,14 @@
+[
+ {
+ "name": "dictionary Signature-Agent (E.2.1)",
+ "signature_agent": "sig2=\"https://signature-agent.test\"",
+ "signature_input": "sig2=(\"@authority\" \"signature-agent\";key=\"sig2\");created=1735689600;keyid=\"poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U\";alg=\"ed25519\";expires=4889289600;nonce=\"n9p433xm+NJ3ph3upfBIGmsuwHw387YV7Q/F+6BSpGCVjYCqQw6rznNA8PVVLySrAWsv0hQtFioQb6E1YsauiA==\";tag=\"web-bot-auth\"",
+ "signature": "sig2=:CGokAoY/FrPpyuzTe1Fb2kLTAH9Idw6qSFd1+D77r1firsMRCxeuLu5e6O+ek3zQgDMAzjiXtLVfqE00xnABCQ==:"
+ },
+ {
+ "name": "legacy Signature-Agent (E.2.2)",
+ "signature_agent": "\"https://signature-agent.test\"",
+ "signature_input": "sig2=(\"@authority\" \"signature-agent\");created=1735689600;keyid=\"poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U\";alg=\"ed25519\";expires=1735693200;nonce=\"e8N7S2MFd/qrd6T2R3tdfAuuANngKI7LFtKYI/vowzk4lAZYadIX6wW25MwG7DCT9RUKAJ0qVkU0mEeLElW1qg==\";tag=\"web-bot-auth\"",
+ "signature": "sig2=:jdq0SqOwHdyHr9+r5jw3iYZH6aNGKijYp/EstF4RQTQdi5N5YYKrD+mCT1HA1nZDsi6nJKuHxUi/5Syp3rLWBA==:"
+ }
+]
diff --git a/examples/verification-workers/test/index.spec.ts b/examples/verification-workers/test/index.spec.ts
index 155ada4..a71efd1 100644
--- a/examples/verification-workers/test/index.spec.ts
+++ b/examples/verification-workers/test/index.spec.ts
@@ -24,6 +24,7 @@ import { sign } from "web-bot-auth";
import { signerFromJWK } from "web-bot-auth/crypto";
import worker from "../src/index";
import jwk from "../../rfc9421-keys/ed25519.json" with { type: "json" };
+import draftVectors from "./draft-ietf-webbotauth-httpsig-protocol-01.json" with { type: "json" };
// For now, you'll need to do something like this to get a correctly-typed
// `Request` to pass to `worker.fetch()`.
@@ -278,24 +279,7 @@ describe("/v0/api/verify endpoint", () => {
// Appendix E.2.1 (dictionary Signature-Agent) and E.2.2 (legacy sf-string).
// They are signed outside this repo, so they catch a signature base that
// sign() and verify() would otherwise agree on.
- it.each([
- {
- name: "dictionary Signature-Agent (E.2.1)",
- agent: 'sig2="https://signature-agent.test"',
- input:
- 'sig2=("@authority" "signature-agent";key="sig2");created=1735689600;keyid="poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U";alg="ed25519";expires=4889289600;nonce="n9p433xm+NJ3ph3upfBIGmsuwHw387YV7Q/F+6BSpGCVjYCqQw6rznNA8PVVLySrAWsv0hQtFioQb6E1YsauiA==";tag="web-bot-auth"',
- signature:
- "sig2=:CGokAoY/FrPpyuzTe1Fb2kLTAH9Idw6qSFd1+D77r1firsMRCxeuLu5e6O+ek3zQgDMAzjiXtLVfqE00xnABCQ==:",
- },
- {
- name: "legacy Signature-Agent (E.2.2)",
- agent: '"https://signature-agent.test"',
- input:
- 'sig2=("@authority" "signature-agent");created=1735689600;keyid="poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U";alg="ed25519";expires=1735693200;nonce="e8N7S2MFd/qrd6T2R3tdfAuuANngKI7LFtKYI/vowzk4lAZYadIX6wW25MwG7DCT9RUKAJ0qVkU0mEeLElW1qg==";tag="web-bot-auth"',
- signature:
- "sig2=:jdq0SqOwHdyHr9+r5jw3iYZH6aNGKijYp/EstF4RQTQdi5N5YYKrD+mCT1HA1nZDsi6nJKuHxUi/5Syp3rLWBA==:",
- },
- ])("accepts the draft $name vector", async ({ agent, input, signature }) => {
+ it.each(draftVectors)("accepts the draft $name vector", async (vector) => {
vi.useFakeTimers({ toFake: ["Date"] });
vi.setSystemTime(new Date("2025-01-01T00:01:00Z"));
const uri =
@@ -310,9 +294,9 @@ describe("/v0/api/verify endpoint", () => {
const request = new IncomingRequest(`${sampleURL}/v0/api/verify`, {
headers: {
- "Signature-Agent": agent,
- "Signature-Input": input,
- Signature: signature,
+ "Signature-Agent": vector.signature_agent,
+ "Signature-Input": vector.signature_input,
+ Signature: vector.signature,
},
});
const response = await worker.fetch(request, env, createExecutionContext());