Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 03696ce101287107673e7ca0e4e3e33c94203dd2
parent 4f8f80e4fb28125824a28bbcedb1f8e32efca1b1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon,  9 Nov 2026 20:46:44 -0500

umtool: the rail's actions refuse another site's POST and a body that is not JSON (L5 review 1)

POST /api/ingredients/action runs crossSiteRefusal (lib/report/sameOrigin.mjs) first -- a cross-site or foreign-Origin request is a 403 -- and requires Content-Type application/json (415), which a no-cors form post cannot send. A start now carries the plan's key through.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/app/api/ingredients/action/route.ts | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/umtool/app/api/ingredients/action/route.ts b/umtool/app/api/ingredients/action/route.ts @@ -1,6 +1,7 @@ import { CHANNELS_DIR, REPORTS_ROOT } from "@/lib/paths"; import { jobView, runningJob, startJob } from "@/lib/jobs"; import { refuseCaller } from "@/lib/report/caller"; +import { crossSiteRefusal } from "@/lib/report/sameOrigin.mjs"; import { UMTOOL_DIR } from "@/lib/report/driver.mjs"; import { EditorError, editorConfig } from "@/lib/report/fetchWindows.mjs"; import { ActionError, parseClipList, planAction, quoteCheckArgv, startAction } from "@/lib/ingredients/actions.mjs"; @@ -23,6 +24,11 @@ export const dynamic = "force-dynamic"; const headers = { "cache-control": "no-store" }; export async function POST(request: Request) { + // Another site's page may not start a download, a transcription or an evict: a cross-site or foreign-Origin + // POST is refused (sameOrigin.mjs), and the body must be JSON -- which a no-cors form post cannot send. + const cross = crossSiteRefusal(request.headers); + if (cross) return Response.json({ error: cross }, { status: 403, headers }); + if (!/^application\/json\b/i.test(request.headers.get("content-type") ?? "")) return Response.json({ error: "the body must be application/json" }, { status: 415, headers }); const refused = refuseCaller(request, "/api/ingredients/action"); if (refused) return refused; const b = (await request.json().catch(() => null)) as Record<string, unknown> | null; @@ -35,6 +41,7 @@ export async function POST(request: Request) { ...(b.clips !== undefined ? { clips: b.clips as string[] } : {}), ...(b.window !== undefined ? { window: String(b.window) } : {}), ...(b.fix === true ? { fix: true } : {}), + ...(typeof b.key === "string" ? { key: b.key } : {}), }; const ctx = { cfg: editorConfig(), reportsRoot: REPORTS_ROOT, channelsDir: CHANNELS_DIR }; try {