@decocms/tanstack 7.81.4 → 7.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/sdk/workerEntry.test.ts +23 -0
- package/src/sdk/workerEntry.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/tanstack",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.82.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco framework binding for TanStack Start + Cloudflare Workers",
|
|
6
6
|
"repository": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"lint:unused": "knip"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@decocms/blocks": "7.
|
|
31
|
-
"@decocms/blocks-admin": "7.
|
|
32
|
-
"@decocms/blocks-cli": "7.
|
|
30
|
+
"@decocms/blocks": "7.82.0",
|
|
31
|
+
"@decocms/blocks-admin": "7.82.0",
|
|
32
|
+
"@decocms/blocks-cli": "7.82.0",
|
|
33
33
|
"@deco-cx/warp-node": "^0.3.16",
|
|
34
34
|
"fast-json-patch": "^3.1.0",
|
|
35
35
|
"ws": "^8.18.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@tanstack/react-query": ">=5.0.0",
|
|
39
|
-
"@tanstack/react-start": ">=1.
|
|
39
|
+
"@tanstack/react-start": ">=1.168.60",
|
|
40
40
|
"@tanstack/store": ">=0.7.0",
|
|
41
41
|
"react": "^19.0.0",
|
|
42
42
|
"react-dom": "^19.0.0",
|
|
@@ -539,6 +539,29 @@ describe("security headers — frame-ancestors default", () => {
|
|
|
539
539
|
expect(res.headers.get("X-Content-Type-Options")).toBeNull();
|
|
540
540
|
});
|
|
541
541
|
|
|
542
|
+
it("sandboxes HTML from a server function, even with securityHeaders false (CVE-2026-102989)", async () => {
|
|
543
|
+
for (const securityHeaders of [undefined, false as const]) {
|
|
544
|
+
const worker = createDecoWorkerEntry(HTML_SERVER_ENTRY, { securityHeaders });
|
|
545
|
+
const res = await worker.fetch(
|
|
546
|
+
new Request("https://example.com/_serverFn/abc?payload=%7B%7D"),
|
|
547
|
+
EMPTY_ENV,
|
|
548
|
+
MOCK_CTX,
|
|
549
|
+
);
|
|
550
|
+
expect(res.headers.get("Content-Security-Policy")).toBe("sandbox");
|
|
551
|
+
expect(res.headers.get("CDN-Cache-Control")).toBe("no-store");
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
it("leaves a server function's JSON alone", async () => {
|
|
556
|
+
const worker = createDecoWorkerEntry({ fetch: async () => Response.json({ ok: true }) });
|
|
557
|
+
const res = await worker.fetch(
|
|
558
|
+
new Request("https://example.com/_serverFn/abc?payload=%7B%7D"),
|
|
559
|
+
EMPTY_ENV,
|
|
560
|
+
MOCK_CTX,
|
|
561
|
+
);
|
|
562
|
+
expect(res.headers.get("Content-Security-Policy")).toBeNull();
|
|
563
|
+
});
|
|
564
|
+
|
|
542
565
|
it("keeps report-only by default even when a site passes csp (cspMode unset)", async () => {
|
|
543
566
|
const worker = createDecoWorkerEntry(HTML_SERVER_ENTRY, {
|
|
544
567
|
csp: ["default-src 'self'"],
|
package/src/sdk/workerEntry.ts
CHANGED
|
@@ -2278,6 +2278,19 @@ export function createDecoWorkerEntry(
|
|
|
2278
2278
|
response.headers.set("CDN-Cache-Control", "no-store");
|
|
2279
2279
|
}
|
|
2280
2280
|
|
|
2281
|
+
// A server function never answers a page: HTML there is a forged response
|
|
2282
|
+
// (CVE-2026-102989: TanStack Start ≤1.168.59 returned a client-injected
|
|
2283
|
+
// `result`, which h3 accepts as a response by its constructor's name). A
|
|
2284
|
+
// sandboxed opaque origin runs no script and reads no cookie, and the CDN
|
|
2285
|
+
// keeps no copy. Not covered by `securityHeaders: false` on purpose.
|
|
2286
|
+
if (
|
|
2287
|
+
isServerFnPathname(new URL(request.url).pathname) &&
|
|
2288
|
+
(response.headers.get("content-type") ?? "").includes("text/html")
|
|
2289
|
+
) {
|
|
2290
|
+
response.headers.set("Content-Security-Policy", "sandbox");
|
|
2291
|
+
response.headers.set("CDN-Cache-Control", "no-store");
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2281
2294
|
let finalResponse = applySecurityHeaders(response, cspNonce);
|
|
2282
2295
|
|
|
2283
2296
|
// Echo request.id + trace.id back to the client / tail worker.
|