Skip to content

Commit a6eb444

Browse files
authored
Merge branch 'main' into seroval-custom-plugins
2 parents df08115 + d8f1ea8 commit a6eb444

6 files changed

Lines changed: 33 additions & 3 deletions

File tree

‎.changeset/lucky-moths-nonce.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@solidjs/start": patch
3+
---
4+
5+
Apply the configured `nonce` to the two script tags that were still missing it, so a strict `script-src` CSP no longer needs `unsafe-inline`:
6+
7+
- The client-side redirect that streaming mode emits after the shell has already flushed (`<script>window.location=...</script>`) now carries the nonce.
8+
- The SPA entry script tag now carries the nonce, matching the SSR entry script.

‎.changeset/pre.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
"bright-dogs-serve",
1010
"chilly-rabbits-lie",
1111
"eleven-actors-nail",
12+
"lucky-pans-gather",
1213
"olive-apes-clap",
1314
"olive-pugs-shave",
1415
"sour-knives-look",
1516
"spotty-jobs-relax",
16-
"spotty-moons-repeat"
17+
"spotty-moons-repeat",
18+
"tricky-goats-cheer",
19+
"wild-pots-repeat"
1720
]
1821
}

‎packages/start/CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @solidjs/start
22

3+
## 2.0.0-rc.4
4+
5+
### Patch Changes
6+
7+
- b6dfaac: Updated dependencies, including `cookie-es` to 3, `shiki` to 4, `srvx` to 0.12.4, `oxc-parser` to 0.141 and `seroval` to 1.5.6. `parseSetCookie` now returns `undefined` for cookies with a forbidden name or an empty name and value, and those cookies are no longer forwarded to nested server function requests.
8+
- 02cd41e: Stop the dev toolbar from reporting benign `ResizeObserver loop` notifications as application errors. Browsers dispatch these as window `error` events carrying no error object, so the toolbar was capturing the raw `ErrorEvent` and force-opening the error panel over the app on every resize.
9+
- d3c2af2: Don't send server error stack traces to the client in production builds. When a server function throws, the error is serialized and rethrown on the client, and seroval included `Error.prototype.stack` by default, leaking server file paths and internal function names. Stacks are still serialized in development.
10+
311
## 2.0.0-rc.3
412

513
### Patch Changes

‎packages/start/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solidjs/start",
3-
"version": "2.0.0-rc.3",
3+
"version": "2.0.0-rc.4",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/solidjs/solid-start.git",

‎packages/start/src/server/handler.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,20 @@ function handleStreamCompleteRedirect(context: PageEvent) {
210210
return ({ write }: { write: (html: string) => void }) => {
211211
context.complete = true;
212212
const to = context.response && context.response.headers.get("Location");
213-
to && write(`<script>window.location=${JSON.stringify(to).replace(/</g, "\\u003c")}</script>`);
213+
if (!to) return;
214+
// The shell has already flushed, so the redirect has to happen client side.
215+
// Carry the nonce so a strict `script-src` CSP doesn't block it.
216+
const nonce = context.nonce ? ` nonce="${escapeAttribute(context.nonce)}"` : "";
217+
write(
218+
`<script${nonce}>window.location=${JSON.stringify(to).replace(/</g, "\\u003c")}</script>`,
219+
);
214220
};
215221
}
216222

223+
function escapeAttribute(value: string) {
224+
return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
225+
}
226+
217227
function stripBaseUrl(path: string) {
218228
const base = import.meta.env.SERVER_BASE_URL || import.meta.env.BASE_URL || "/";
219229
return stripPathBase(path, base);

‎packages/start/src/server/spa/StartServer.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function StartServer(props: { document: Component<DocumentComponentProps>
3131
<PatchVirtualDevStyles nonce={nonce} />
3232
<script
3333
type="module"
34+
nonce={nonce}
3435
src={getSsrManifest("client").path(import.meta.env.START_CLIENT_ENTRY_URL)}
3536
/>
3637
</>

0 commit comments

Comments
 (0)