@devries-cameron20 / t3code-1 / commits / 94aa3d7736
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): other sites can no longer frame the web app (#36395)

Julius Marminge committed Nov 13, 2026 at 13:39 UTC 94aa3d7736cd29e5c05483c37203be8140ba5832
2 files changed +10
apps/server/src/http.test.ts
+2
@@ -399,6 +399,8 @@ it.layer(
399 expect(response.status).toBe(200);
400 expect(yield* response.text).toBe(nextHtml);
401 expect(response.headers["cache-control"]).toBe("no-cache");
402 + expect(response.headers["content-security-policy"]).toBe("frame-ancestors 'none'");
403 + expect(response.headers["x-frame-options"]).toBe("DENY");
404 expect(response.headers["etag"]).toBeUndefined();
405 expect(response.headers["last-modified"]).toBeUndefined();
406 }
apps/server/src/http.ts
+8
@@ -564,6 +564,12 @@ const streamStaticFile = (file: FileSystem.File, size: bigint) =>
564 }),
565 );
566
567 +// The app can approve agents and start threads in one click, so no other site may frame it.
568 +const SPA_FRAME_HEADERS = {
569 + "Content-Security-Policy": "frame-ancestors 'none'",
570 + "X-Frame-Options": "DENY",
571 +};
572 +
573 const handleStaticAndDevRequest = Effect.fn("handleStaticAndDevRequest")(
574 function* (immutableBuildAssets: ReadonlySet<string>) {
575 const request = yield* HttpServerRequest.HttpServerRequest;
@@ -664,6 +670,7 @@ const handleStaticAndDevRequest = Effect.fn("handleStaticAndDevRequest")(
670 };
671 const headers: Record<string, string> = {
672 "Cache-Control": cacheControl,
673 + ...(isHtml ? SPA_FRAME_HEADERS : {}),
674 ...validators(fileInfo),
675 };
676 const etag = headers.ETag;
@@ -700,6 +707,7 @@ const handleStaticAndDevRequest = Effect.fn("handleStaticAndDevRequest")(
707 return HttpServerResponse.uint8Array(bytes, {
708 headers: {
709 "Cache-Control": cacheControl,
710 + ...(isHtml ? SPA_FRAME_HEADERS : {}),
711 ...validators({ ...info, size: ByteSize.bytes(bytes.byteLength) }),
712 },
713 contentType,