Skip to content

Commit 64f46af

Browse files
zachdunnclaude
andauthored
chore(api): move blocked-urls under /v1/admin/blocklist (#597)
Closes #524. Routes now live at /v1/admin/blocklist; updates the adminRoutes allowlist, agent block tool, and eval-task cleanup to match. CLI client + whoami probe move in a follow-up release. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a150122 commit 64f46af

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

docs/architecture/remote-mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The API worker at `workers/api/` is the authoritative data plane — every read
44

55
## Auth model
66

7-
GET endpoints are public (no auth required). Write operations (POST/PATCH/DELETE) require a Bearer token. The `publicReadAuthMiddleware` in `workers/api/src/middleware/auth.ts` handles this split. Admin-only routes (sessions, `admin/*`, `workflows/*`, blocked-urls) require auth for all methods. The `GET /v1/orgs/:slug/playbook` endpoint is also admin-only (inline `authMiddleware` on the handler) since playbook content is internal.
7+
GET endpoints are public (no auth required). Write operations (POST/PATCH/DELETE) require a Bearer token. The `publicReadAuthMiddleware` in `workers/api/src/middleware/auth.ts` handles this split. Admin-only routes (sessions, `admin/*`, `workflows/*`) require auth for all methods. The `GET /v1/orgs/:slug/playbook` endpoint is also admin-only (inline `authMiddleware` on the handler) since playbook content is internal.
88

99
## On-demand AI admin endpoints
1010

scripts/run-eval-task.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ async function runCleanup(t: (typeof TASKS)[number], phase: "pre" | "post"): Pro
236236
return cleanupFetch("DELETE", `/orgs/${encodeURIComponent(args.slug)}`);
237237
}
238238
if (kind === "unblock_url") {
239-
return cleanupFetch("DELETE", `/blocked-urls/${encodeURIComponent(args.pattern)}`);
239+
return cleanupFetch("DELETE", `/admin/blocklist/${encodeURIComponent(args.pattern)}`);
240240
}
241241
if (kind === "unignore_url") {
242242
return cleanupFetch(

src/shared/agent-tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ export function createTypedExecutor(opts: APIClientOptions) {
606606
const body: Record<string, unknown> = { pattern: url };
607607
if (input.block_type) body.type = input.block_type;
608608
if (input.reason) body.reason = input.reason;
609-
return api("POST", "/blocked-urls", body);
609+
return api("POST", "/admin/blocklist", body);
610610
}
611611

612612
return `Error: unknown action "${action}"`;

workers/api/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ for (const r of publicReadRoutes) {
207207
// Admin-only routes: all methods require auth.
208208
const adminRoutes = [
209209
"sessions",
210-
"blocked-urls",
211210
"evaluate",
212211
"status/fetch-log",
213212
"status/usage",
214213
"status/event",
214+
"admin/blocklist",
215215
"admin/embed/status",
216216
"admin/cron-runs",
217217
"admin/logs",

workers/api/src/routes/ignore.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ ignoreRoutes.delete("/orgs/:slug/ignored-urls/:url", async (c) => {
6666
return c.json({ deleted: true });
6767
});
6868

69-
// ── Global blocked URLs: /blocked-urls ──
69+
// ── Global blocked URLs: /admin/blocklist ──
7070

71-
ignoreRoutes.get("/blocked-urls", async (c) => {
71+
ignoreRoutes.get("/admin/blocklist", async (c) => {
7272
const db = createDb(c.env.DB);
7373

7474
const singleUrl = c.req.query("url");
@@ -98,7 +98,7 @@ ignoreRoutes.get("/blocked-urls", async (c) => {
9898
return c.json(rows);
9999
});
100100

101-
ignoreRoutes.post("/blocked-urls", async (c) => {
101+
ignoreRoutes.post("/admin/blocklist", async (c) => {
102102
const db = createDb(c.env.DB);
103103
const body = await c.req.json<{ pattern: string; type?: "exact" | "domain"; reason?: string }>();
104104

@@ -118,7 +118,7 @@ ignoreRoutes.post("/blocked-urls", async (c) => {
118118
return c.json({ blocked: true }, 201);
119119
});
120120

121-
ignoreRoutes.delete("/blocked-urls/:pattern", async (c) => {
121+
ignoreRoutes.delete("/admin/blocklist/:pattern", async (c) => {
122122
const db = createDb(c.env.DB);
123123
const pattern = decodeURIComponent(c.req.param("pattern"));
124124

0 commit comments

Comments
 (0)