Skip to content

Fix verified web audit findings: CodeBlock XSS, block-mode send, store sync, parser grammar - #53

Merged
Aztec03hub merged 1 commit into
mainfrom
worktree-agent-ab24c4e16bfa16e16
Jun 26, 2026
Merged

Fix verified web audit findings: CodeBlock XSS, block-mode send, store sync, parser grammar#53
Aztec03hub merged 1 commit into
mainfrom
worktree-agent-ab24c4e16bfa16e16

Conversation

@Aztec03hub

Copy link
Copy Markdown
Owner

Fixes a batch of verified audit findings in the web client (web files only).

High

  • CodeBlock XSS (CodeBlock.svelte) — the <pre> rendered the raw, unescaped code.split('\n') fallback through {@html} during the always-present pre-Shiki window, so a code block containing <img onerror=...> from a chat message executed. The fallback now renders as escaped text nodes; only the already-safe Shiki output goes through {@html}.
  • Send button dead for code-block-only messages (MessageInput.svelte)disabled ignored blockMode.body, so a message whose body lived only in block mode could never be sent via the button (real clicks are dropped on a disabled button). The gate now considers blockMode?.body.

Medium

  • markAllRead never advanced the server cursor (mqtt-store)comms_check omitted mark_seen, so cleared unread/mention dots resurrected on the next reconnect/visibility-regain. Now passes mark_seen: true.
  • status:'sending' leaked onto the wire (mqtt-store)sendMessage/forwardMessage published the local-echo status, leaving other clients with a permanent "Sending…" spinner. Both now strip status before publish (mirroring retryMessage).
  • forwardMessage inflated the sender's own unread (mqtt-store) — the non-active-channel unread bump had no self-author guard. Added one.
  • Mention name char-class drift (mentions.js, dm-parser.js) — aligned to the Python server authority NAME_PATTERN = ^[\w-]{1,64}$ (no dot). utils.js already matched. e.g. @bob. now stops at bob.
  • Highlight-word case-sensitivity (notifications.svelte.js) — the body was lowercased but the word was not, so uppercase highlight words never matched. Now lowercases the word in the comparison.

Low

  • Removed dead utils.parseInlineCode (zero callers) and the dead _pendingActivity stash (written, never read).

Tests

+8 net (1292 → 1300), zero skips: CodeBlock pre-highlight escape test, block-mode send enabled/disabled tests, forward self-unread + wire status-strip assertions, uppercase highlight-word test, dot-terminator parser tests; corrected the markAllRead call-shape assertion.

Gates: pnpm --dir web test green (3x, no flakiness, no stderr noise), pnpm --dir web build green.

🤖 Generated with Claude Code

…c, parsers)

WEB-E (HIGH): CodeBlock no longer renders the raw pre-Shiki fallback via
{@html}. Until the async Shiki highlight resolves, code lines render as
escaped text nodes, closing the XSS window where a code block containing
<img onerror=...> from a chat message executed.

WEB-B (HIGH): MessageInput send button now considers blockMode.body, so a
code-block-only message (inputValue empty, body in block mode) is sendable
via the button instead of being permanently disabled.

WEB-A (MED): markAllRead passes mark_seen:true so the server read cursor
advances (unread/mention dot no longer resurrect on reconnect);
sendMessage/forwardMessage strip the internal status field before publish
(no more stuck "Sending…" spinner on other clients); forwardMessage no
longer inflates the sender's own unread (self-author guard).

WEB-C (MED/LOW): mention name char-class aligned to the server authority
[\w-] (no dot) in mentions.js and dm-parser.js (utils.js already matched);
highlight-word match lowercases the word so uppercase words match; removed
dead utils.parseInlineCode and the dead _pendingActivity stash.

Tests: +8 (1292 -> 1300). Added CodeBlock pre-highlight escape test,
send-enabled/disabled block-mode tests, forward self-unread + wire
status-strip tests, uppercase highlight-word test, dot-terminator parser
tests; corrected the markAllRead call-shape assertion.
@Aztec03hub
Aztec03hub merged commit 6de7512 into main Jun 26, 2026
7 of 8 checks passed
@Aztec03hub
Aztec03hub deleted the worktree-agent-ab24c4e16bfa16e16 branch June 26, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant