Skip to content

An open-source, faster Devin alternative

TypeScript

Webhooks: redact everything after the webhook id in the collector; docs state the identity classes

Igor Zalutskif378418eaeb9
diff --git a/cloudflare-workers/log-tail/src/index.test.ts b/cloudflare-workers/log-tail/src/index.test.ts
index a3069858..b8b00783 100644
--- a/cloudflare-workers/log-tail/src/index.test.ts
+++ b/cloudflare-workers/log-tail/src/index.test.ts
@@ -81,12 +81,29 @@ test("redacts the webhook credential segment from request URLs", async () => {
},
logs: [],
exceptions: [],
+ }, {
+ scriptName: "api-edge",
+ outcome: "ok",
+ eventTimestamp: Date.parse("2026-09-08T20:00:02Z"),
+ event: {
+ request: {
+ method: "POST",
+ url: `https://app.opencomputer.dev/api/agent-webhooks/wh_0123456789abcdef0123456789abcdef/${token}/extra/`,
+ },
+ response: { status: 502 },
+ },
+ logs: [],
+ exceptions: [],
}], env, {} as ExecutionContext);
} finally {
globalThis.fetch = originalFetch;
}
- assert.equal(records.length, 2);
+ assert.equal(records.length, 3);
+ assert.equal(
+ records[2]?.request_url,
+ "https://app.opencomputer.dev/api/agent-webhooks/wh_0123456789abcdef0123456789abcdef/redacted",
+ );
assert.equal(
records[0]?.request_url,
"https://app.opencomputer.dev/api/agent-webhooks/wh_0123456789abcdef0123456789abcdef/redacted",
diff --git a/cloudflare-workers/log-tail/src/index.ts b/cloudflare-workers/log-tail/src/index.ts
index 17c50fa7..595f502a 100644
--- a/cloudflare-workers/log-tail/src/index.ts
+++ b/cloudflare-workers/log-tail/src/index.ts
@@ -54,9 +54,10 @@ function safeStringify(v: unknown): string {
catch { return String(v); }
}
-// Agent webhook URLs carry their credential as the last path segment
-// (public `/api/agent-webhooks/<id>/<token>`, backend `/v1/agent-webhooks/<id>/<token>`).
-const WEBHOOK_TOKEN_PATH = /^(\/(?:api|v1)\/agent-webhooks\/[^/]+)\/[^/]+$/;
+// Agent webhook URLs carry their credential after the webhook id (public
+// `/api/agent-webhooks/<id>/<token>`, backend `/v1/agent-webhooks/<id>/<token>`).
+// Everything after the id is redacted, whatever suffix a malformed request adds.
+const WEBHOOK_TOKEN_PATH = /^(\/(?:api|v1)\/agent-webhooks\/[^/]+)\/.*$/;
// Request query strings can carry browser client tokens (`?token=...`), and
// webhook paths carry the webhook credential. Keep the route useful for
diff --git a/docs/agents/webhooks.mdx b/docs/agents/webhooks.mdx
index 9c10fe34..144beebb 100644
--- a/docs/agents/webhooks.mdx
+++ b/docs/agents/webhooks.mdx
@@ -64,7 +64,7 @@ credential.
The response is HTTP 202 with the request, session ID, and dashboard session
URL. It is sent as soon as the delivery is stored; the session starts
-afterwards, so the response arrives within Sentry's and GitHub's timeouts.
+afterwards, so acknowledgement does not wait for a runtime.
The request's `outcome` is `pending` in the response and becomes `accepted`
once the session is running, or `failed` after five start attempts over
about thirteen minutes. Read outcomes from the request ledger with your API
@@ -78,13 +78,16 @@ curl 'https://app.opencomputer.dev/api/managed-agents/projects/<project-id>/webh
Each delivery needs an identity so that a retry does not start a second
session. OpenComputer uses the first available of: your `Idempotency-Key`;
-for Sentry, the alerted event or issue named in the body together with the
+for Sentry event alerts and errors, the event id in the body under the
`Sentry-Hook-Resource` header, which stays the same across Sentry's retries
while its `Request-ID` does not; `X-GitHub-Delivery`; for Stripe, the event
-id in the body; `Svix-Id`; and finally `Request-ID`. Retrying with the same
-identity and body returns the original request and session; if that request
-had failed to start, the retry starts it again. A body larger than 256 KiB
-once wrapped as agent input is rejected with 400 before acknowledgement.
+id in the body; `Svix-Id`; and finally `Request-ID`. Other Sentry
+notifications, such as issue and comment changes, use `Request-ID`.
+Retrying with the same `Idempotency-Key` and a different body is a 409; a
+provider retry under a derived identity returns the original request even
+if the provider reserialized the body. If the original request had failed
+to start, the retry starts it again. A body larger than 256 KiB once wrapped
+as agent input is rejected with 400 before acknowledgement.
## Read webhook input