# ChatStudio Overlay Audit — v4.5.70 Date: 2026-06-18 Auditor: Hermes Agent Files reviewed: module-chatstudio.js (1,064 lines), chat-commands.js (276 lines), chat-modules.js (375 lines), chat-ui.html (160 lines), chat-ui.css (747 lines) ## P0 — Critical Security (3 issues) — FIXED in v4.5.70 | # | Issue | File:Line | Status | |---|-------|-----------|--------| | 1 | XSS via single-quote injection — `escapeHtml()` didn't escape `'`, module IDs injected into `onclick` with single-quote delimiters | module-chatstudio.js:254, chat-modules.js:113-117 | ✅ Fixed — added `'` escaping | | 2 | Iframe preview without sandbox — `showHtmlPreview()`/`previewCodeBlock()` write AI content into unsandboxed iframe with full parent access | chat-ui.html:157 | ✅ Fixed — `sandbox="allow-same-origin"` | | 3 | `importModules()` accepts unvalidated JSON — zero schema check, no ID sanitization, one-click XSS via crafted import file | chat-modules.js:339-367 | ✅ Fixed — 1MB limit, schema validation, ID sanitization | ## P1 — Bugs & Reliability (7 issues) — NOT YET FIXED | # | Issue | File:Line | Impact | |---|-------|-----------|--------| | 4 | No fetch timeouts — 11 bare `fetch()` calls with no AbortController | chat-commands.js:98,143,147,181,207,228,244,258 + module-chatstudio.js:446,465,773,860 | Slow/hung backend freezes chat indefinitely | | 5 | No streaming cancel — once `isStreaming=true`, no abort button or timeout | module-chatstudio.js:751-856 | Model hang = page reload required | | 6 | CSS load race condition — `resolve()` fires before CSS `` onload | module-chatstudio.js:39-46 | FOUC on first overlay open | | 7 | `oninput` for Enter key — unreliable across browsers, should be `onkeydown` | chat-ui.html:65 | Enter key may not submit on some browsers | | 8 | Duplicate `modules` array — `chat-modules.js:75` declares local `var modules` shadowing `window.modules` | chat-modules.js:75 vs module-chatstudio.js:960 | If load order changes, `handleCommand` sees empty array | | 9 | `_csGlobalsInited` stuck true after init failure — placeholder stubs remain active on retry | module-chatstudio.js:94 vs 1054 | Retry silently does nothing | | 10 | `generateModuleWithAI` uses deprecated global `event` | chat-modules.js:276 | Fails in strict mode | ## P2 — UX & Architecture (8 issues) — ALL FIXED in v4.5.74 | # | Issue | File:Line | Status | |---|-------|-----------|--------| | 11 | API key in base64 localStorage | module-chatstudio.js:419 | ✅ Fixed — API key no longer persisted, in-memory only | | 12 | Inconsistent storage encoding | module-chatstudio.js:505 | ✅ Fixed — logs/settings now plain JSON, backward-compat base64 fallback | | 13 | Chat history no max size | module-chatstudio.js:502-508 | ✅ Fixed — capped at MAX_MESSAGES=100 | | 14 | Static `?v=5` cache-busting | module-chatstudio.js | ✅ Fixed — uses NEWOS4_VERSION | | 15 | `buildChatContext` naive HTML strip | module-chatstudio.js:888 | ✅ Fixed — DOMParser with regex fallback | | 16 | User messages get no markdown | module-chatstudio.js:548 | ✅ Fixed — formatContent applied to user msgs too | | 17 | Activity log hardcoded 50 limit | module-chatstudio.js:325 | ✅ Fixed — MAX_LOGS=200, configurable | | 18 | `CHATSTUDIO_VERSION` not synced | module-chatstudio.js:231 | ✅ Fixed — uses window.NEWOS4_VERSION | ## Tool-Use Optimization — Applied in v4.5.70 From AI self-report: - Search retry strategy: system prompt instructs AI to retry with `site:` operators if first search returns generic portals - No "waiting" hallucinations: system prompt bans announcing tool use ("Hold on...", "Fetching...") - Typo tolerance: system prompt instructs AI to recognize malformed commands and suggest correct one - Date injection: ChatStudio overlay now injects current date into every AI request - Updated default module prompt: lists all 4 tools (search, fetch, extract, summarize) with tool-use rules - Updated help text: shows all available commands