mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-05 10:55:29 +00:00
`mdToHtml` deliberately stashes literal <details> blocks and <a> tags from the source text *before* the global HTML-escape pass and restores them verbatim into the string callers assign to `innerHTML` (e.g. chatRenderer's `b.innerHTML = ...processWithThinking(text)`). Nothing scrubbed those fragments, so message/agent content containing `<details><img src=x onerror=...></details>` or `<a href="javascript:..." onmouseover=...>` executed arbitrary script in the authenticated page. Route both stashed fragments through `sanitizeAllowedHtml()`, which parses them in an inert <template> (no resource loads, no script execution), removes script-capable elements, and strips event-handler attributes plus javascript:/vbscript:/data: URL schemes. Hardening details: - Compare tag names case-insensitively and drop the SVG/MathML foreign- content roots. An SVG-namespaced <script> has the lower-case tagName 'script', so an HTML-only upper-case check would miss it — a real bypass. - Sanitize to a fixpoint (re-parse + re-clean until stable) to blunt mutation-XSS, where re-serializing/re-parsing reshapes the tree. Benign anchors and <details> blocks are preserved unchanged. Verified under jsdom against the obvious vectors plus mutation-XSS probes (svg/math-namespaced <script>, foreignObject, ns-confusion, comment breakout, template smuggling): no script/iframe element, event handler, or javascript:/data: URL survives, and benign markup is kept. Co-authored-by: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| calendar | ||
| compare | ||
| editor | ||
| emailLibrary | ||
| research | ||
| admin.js | ||
| assistant.js | ||
| calendar.js | ||
| censor.js | ||
| chat.js | ||
| chatRenderer.js | ||
| chatStream.js | ||
| codeRunner.js | ||
| colorPicker.js | ||
| cookbook-diagnosis.js | ||
| cookbook-hwfit.js | ||
| cookbook.js | ||
| cookbookDownload.js | ||
| cookbookRunning.js | ||
| cookbookServe.js | ||
| document.js | ||
| documentLibrary.js | ||
| dragSort.js | ||
| emailInbox.js | ||
| emailLibrary.js | ||
| emojiPicker.js | ||
| fileHandler.js | ||
| gallery.js | ||
| galleryEditor.js | ||
| group.js | ||
| init.js | ||
| keyboard-shortcuts.js | ||
| langIcons.js | ||
| markdown.js | ||
| memory.js | ||
| modalManager.js | ||
| modalSnap.js | ||
| modelPicker.js | ||
| models.js | ||
| modelSort.js | ||
| MODULE_SUMMARY.md | ||
| notes.js | ||
| presets.js | ||
| providers.js | ||
| rag.js | ||
| researchSynapse.js | ||
| search-chat.js | ||
| search.js | ||
| section-management.js | ||
| sessions.js | ||
| settings.js | ||
| sidebar-layout.js | ||
| signature.js | ||
| skills.js | ||
| slashCommands.js | ||
| spinner.js | ||
| storage.js | ||
| tasks.js | ||
| theme.js | ||
| tileManager.js | ||
| tourAutoplay.js | ||
| tourHints.js | ||
| tts-ai.js | ||
| ui.js | ||
| voiceRecorder.js | ||
| windowDrag.js | ||