Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/workers/workers/crawlerWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ async function archiveWebpage(
: undefined,
no_proxy: serverConfig.proxy.noProxy?.join(","),
},
})("monolith", ["-", "-Ije", "-t", "5", "-b", url, "-o", assetPath]);
})("monolith", ["-", "-Ie", "-t", "5", "-b", url, "-o", assetPath]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing JavaScript in archived pages creates a stored XSS risk. The archived HTML is later rendered using dangerouslySetInnerHTML in BookmarkHTMLHighlighter.tsx (line 411) without sanitization. While the -I flag provides some isolation, malicious JS from archived pages could still execute in users' browsers and potentially access localStorage, cookies, or make API calls. Consider either:

  1. Using DOMPurify to sanitize the archived HTML before storage/display
  2. Rendering archived content in a sandboxed iframe with strict CSP
  3. Only allowing specific script sources needed for math rendering (e.g., KaTeX/MathJax CDN URLs)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/workers/workers/crawlerWorker.ts
Line: 1428

Comment:
Allowing JavaScript in archived pages creates a stored XSS risk. The archived HTML is later rendered using `dangerouslySetInnerHTML` in `BookmarkHTMLHighlighter.tsx` (line 411) without sanitization. While the `-I` flag provides some isolation, malicious JS from archived pages could still execute in users' browsers and potentially access localStorage, cookies, or make API calls. Consider either:
1. Using DOMPurify to sanitize the archived HTML before storage/display
2. Rendering archived content in a sandboxed iframe with strict CSP
3. Only allowing specific script sources needed for math rendering (e.g., KaTeX/MathJax CDN URLs)

How can I resolve this? If you propose a fix, please make it concise.


if (res.isCanceled) {
logger.error(
Expand Down