-
Notifications
You must be signed in to change notification settings - Fork 292
fix: security audit findings from issue #741 #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,28 @@ | ||
| { | ||
| "name": "vinext-hackernews", | ||
| "type": "module", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "vp dev", | ||
| "build": "vp build", | ||
| "preview": "vp preview" | ||
| }, | ||
| "dependencies": { | ||
| "@vitejs/plugin-react": "catalog:", | ||
| "ms": "catalog:", | ||
| "react": "catalog:", | ||
| "react-dom": "catalog:", | ||
| "server-only": "catalog:", | ||
| "vite": "catalog:", | ||
| "vinext": "workspace:*", | ||
| "@vitejs/plugin-rsc": "catalog:", | ||
| "react-server-dom-webpack": "catalog:", | ||
| "@cloudflare/vite-plugin": "catalog:", | ||
| "wrangler": "catalog:" | ||
| }, | ||
| "devDependencies": { | ||
| "vite-plus": "catalog:" | ||
| } | ||
| "name": "vinext-hackernews", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: This file was reformatted from 2-space to 4-space indentation. Every other Please revert the whitespace-only changes and keep only the meaningful additions ( |
||
| "type": "module", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "vp dev", | ||
| "build": "vp build", | ||
| "preview": "vp preview" | ||
| }, | ||
| "dependencies": { | ||
| "@vitejs/plugin-react": "catalog:", | ||
| "dompurify": "catalog:", | ||
| "ms": "catalog:", | ||
| "react": "catalog:", | ||
| "react-dom": "catalog:", | ||
| "server-only": "catalog:", | ||
| "vite": "catalog:", | ||
| "vinext": "workspace:*", | ||
| "@vitejs/plugin-rsc": "catalog:", | ||
| "react-server-dom-webpack": "catalog:", | ||
| "@cloudflare/vite-plugin": "catalog:", | ||
| "wrangler": "catalog:" | ||
| }, | ||
| "devDependencies": { | ||
| "@cloudflare/workers-types": "catalog:", | ||
| "vite-plus": "catalog:" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,15 @@ | |
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "allowJs": true, | ||
| "baseUrl": ".", | ||
| "types": ["@cloudflare/workers-types"] | ||
| "noEmit": true, | ||
| "types": [ | ||
| "@cloudflare/workers-types" | ||
| ] | ||
| }, | ||
| "include": ["app", "components", "lib", "worker"] | ||
| } | ||
| "include": [ | ||
| "app", | ||
| "components", | ||
| "lib", | ||
| "worker" | ||
| ] | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Missing trailing newline. The diff shows |
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,8 @@ catalog: | |
| clsx: ^2.1.1 | ||
| codehike: 1.0.7 | ||
| date-fns: 4.1.0 | ||
| dompurify: ^3.2.6 | ||
| "@types/dompurify": ^3.0.5 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused catalog entry. Either add it to |
||
| fumadocs-core: 16.6.17 | ||
| fumadocs-mdx: 14.2.10 | ||
| fumadocs-ui: 16.6.17 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug:
DOMPurify.sanitize()is a silent no-op during SSR.This component has
'use client', but in vinext's App Router, client components are still SSR'd viarenderToReadableStreamin the SSR environment. During SSR there is nowindow/document, so DOMPurify setsisSupported = falseandsanitize()returns the input string unchanged (see purify.ts L1541-1543).This means the initial HTML response sent to the browser contains the raw, unsanitized HN API HTML. Sanitization only kicks in after client-side hydration triggers a re-render. A malicious HN comment could execute in the initial page load before React hydrates.
Two options to fix:
isomorphic-dompurifyβ it bundles jsdom for server-side use, so sanitization works in both environments.app/item/[id]/(comments)/page.tsx) before passingtextas a prop. You could use a server-compatible sanitizer there (e.g.,sanitize-htmlorisomorphic-dompurify), which would protect both SSR and client renders.Option 2 is arguably better because it sanitizes once at the data boundary rather than on every render.