Inert hydration data mode for hash-based CSP on cached SSR pages
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
Direzione di ricerca
Start by reading the hydration paths in packages/web/src/server.ts, packages/solid/src/client/hydration.ts, packages/web/src/client.ts, and the bootstrap runtime. Then trace the existing serialization and streaming flow and inspect createJSONSerializer and createJSONDataTable. Done means an opt-in inert data mode with a fixed pump handles streamed values and hydration tasks, is covered by byte-exact fixtures, and adds no bytes when disabled.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Split out of #4028 (proposal 1). Deferred until after 2.0.
Problem
Hydration data is currently executable JS: each flush writes an inline script that assigns seroval output into _$HY.r. Fragment swaps ($df), head ops, the shell-end marker and redirects are inline scripts too.
Under a strict CSP an inline script runs only with a per-request nonce or a listed hash. A cached or CDN-served SSR page can't carry a fresh nonce. Hashes don't help either, because the data scripts' bodies differ per page, so the CSP header can't be written ahead of time.
#4161 made async-mode output deterministic, so the same data now gives the same bytes and the same hashes. That doesn't help when the data itself differs.
Idea
- Inert data: emit values as
type="application/json"script blocks. The browser never executes them, so CSP doesn't apply. - Fixed pump: one runtime script whose bytes are identical on every render, so its hash is a build-time constant for a static CSP header. It decodes the JSON blocks into
_$HY.rand settles streamed promises. Streaming chunks are each followed by the same constant trigger script. - Today's executable tasks (fragment swaps, head ops, shell-end marker) become data records the pump applies. The redirect becomes a meta refresh.
Cost and constraints
- JSON can't express seroval's JS output (shared and cyclic refs, promises, Maps, Dates), so the data uses the JSON data-table format (
createJSONSerializer/createJSONDataTable) plus a client decoder. - This is a second hydration wire format to keep in sync on both server (
packages/web/src/server.ts) and client (packages/solid/src/client/hydration.ts,packages/web/src/client.ts, the bootstrap runtime). - It must be opt-in and pay-for-use: apps that don't enable it should ship zero extra bytes, with the decoder tree-shaken away.
- Rough estimate: 600–1,000 lines plus byte-exact fixtures.
Who needs it: apps serving cached or static SSR HTML under a hash-based CSP. Nonce-based CSP works today.
- Lingua principale
- TypeScript
- Stelle
- 36.2k
- Fork
- 1.1k
- Merge medio
- 10h 38m
- PR unite (30g)
- 352
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di solidjs/solid
-
`lazy()`: remounting an already-loaded component renders empty (or the Suspense fallback) since 1.9.14Forse già presa @itisrmk l’ha presa 6 giorni fa. Aperta1.x
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
solidjs/solid#4242 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 58/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di solidjs/solid
Issue simili
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
openclaw/openclaw#182077 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
aikido high security
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand markForse già presa @eric8810 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[Feature]: 建议导入源后,自动切换到新导入的源Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
lyswhut/lx-music-desktop#3026 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
abhigyanpatwari/GitNexus#3704 ·
I maintainer di solito rispondono entro 1 giorno