Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

2.0.0-rc.15: <Errored> writes a string child as raw HTML on the server

Aperta
#4,116 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, typescript
Ambito
frontend, security

Direzione di ricerca

Start with the repro in the issue: call renderToString on a string child under Loading and under Errored, and compare the output. Find where the server path for Errored emits its children without the escaping that Loading applies. Done when Errored escapes string, array and function children the same way Loading does, and the escape() workaround is no longer needed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

On the server, a string child of <Errored> is written into the HTML unescaped. The same string is escaped as a plain child and as a child of <Loading>, so user text returned from a component inside an error boundary becomes live markup (stored XSS), and the client, which renders a text node, mismatches on hydrate.

Versions: solid-js and @solidjs/web 2.0.0-rc.15 (also rc.14), renderToString on Node.

import { createComponent, Errored, Loading } from "solid-js"
import { renderToString } from "@solidjs/web"

const evil = "<script>alert(1)</script>"
const show = (name: string, fn: () => unknown) => console.log(name.padEnd(12), renderToString(fn as never))
show("plain", () => evil)
show("Loading", () => createComponent(Loading, { fallback: "", get children() { return evil } }))
show("Errored", () => createComponent(Errored, { fallback: "", get children() { return evil } }))
plain        &lt;script>alert(1)&lt;/script>
Loading      &lt;script>alert(1)&lt;/script>
Errored      <script>alert(1)</script>

An array of strings, or a function returning a string, as the boundary's child is raw too.

Expected: Errored escapes its children as Loading does. Workaround: pass the boundary's children through escape() from @solidjs/web on the server.

Lingua principale
TypeScript
Stelle
36.1k
Fork
1.1k
Merge medio
11h 49m
PR unite (30g)
346

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di solidjs/solid

Tutte le issue di solidjs/solid

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.