commit 3855bb54a0f26b2e3f8f45c0fec09c340680a9a3
parent 02a2f04fb73508ea5745e03258118bc936fbeef3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 10 Nov 2026 11:09:50 -0500
umtool: an upload over 10 MB reaches its route whole behind the proxy
With a proxy, Next clones a non-GET body for it and hands the route that
clone cut at experimental.proxyClientMaxBodySize -- 10 MB by default, with
only a console warning. A recording uploaded from a page (post narration,
parts up to 200 MB each; a voice's recording; keep my recording) is bigger,
so the cap is 1gb. The spec sends 12 MB and checks it parses.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/umtool/e2e/write-guard.spec.ts b/umtool/e2e/write-guard.spec.ts
@@ -38,6 +38,11 @@ test("another site's write is refused by the proxy; a terminal's, a read and the
r = await request.post("/api/projects/new", { data: "{}", headers: plain });
expect(r.status()).toBe(400);
expect(await said(r)).toContain("unknown kind");
+ // A body over Next's 10 MB proxy default arrives whole (next.config.ts, proxyClientMaxBodySize): cut, it would
+ // not parse ("bad json").
+ r = await request.post("/api/projects/new", { data: JSON.stringify({ kind: "", pad: "x".repeat(12 * 1024 * 1024) }), headers: plain });
+ expect(r.status()).toBe(400);
+ expect(await said(r)).toContain("unknown kind");
// A read from anywhere is not the proxy's business.
r = await request.get("/api/projects/new?from=", { headers: { origin: "https://evil.example", "sec-fetch-site": "cross-site" } });
expect(r.status()).not.toBe(403);
diff --git a/umtool/next.config.ts b/umtool/next.config.ts
@@ -19,6 +19,16 @@ const nextConfig: NextConfig = {
// fail the whole module graph. Every page importing lib/projects then 500s
// with "Can't resolve 'cbor-x'", which names a package nothing here uses.
serverExternalPackages: ["lmdb"],
+ // THE PROXY READS EVERY API WRITE'S BODY FIRST (proxy.ts, the cross-site
+ // guard). With a proxy, Next clones a non-GET request's body for it and hands
+ // the route that clone -- cut at proxyClientMaxBodySize, 10 MB by default,
+ // with only a console warning: an upload over it reached its route
+ // truncated. A recording uploaded from a page (post narration, its parts up
+ // to 200 MB each, several in one body; a voice's recording; "keep my
+ // recording") is bigger than that, so the cap is far above any of them. The
+ // body was held whole in memory before too (`request.formData()`).
+ // e2e/write-guard.spec.ts sends one over 10 MB and checks it arrives whole.
+ experimental: { proxyClientMaxBodySize: "1gb" },
// The dev indicator defaults to the bottom-left corner, which is the rail's
// foot -- it sat over the theme control on the e2e dev server. (The live
// umtool runs `next start`, which shows no indicator.)