Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng
#4,116 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, typescript
Lĩnh vực
frontend, security

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
36.1k
Fork
1.1k
Merge trung bình
11 giờ 17 phút
Pull request đã merge (30 ngày)
371

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của solidjs/solid

Tất cả issue của solidjs/solid

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.