fix(web): F14 — close 5-expert audit findings (7 HIGH + 7 MEDIUM/LOW)#41
Merged
Conversation
5-expert audit (TS / Frontend / Security / Performance / UX) on
F11+F12+F13 returned 0 CRITICAL, 7 HIGH, ~12 MEDIUM, ~10 LOW. This
PR closes all 7 HIGH + 7 MEDIUM/LOW.
HIGH:
- TS-H1: renderBody returns branded SafeHtml type (string &
{ readonly __safeHtml: unique symbol }). Untrusted strings cannot
reach {@html} via this signature.
- TS-H2: TODO(marked-types) comment near `as string` cast.
- FE-H1: Matrix impact-mode selector extended to include row-header
and col-header (was only .node — Matrix never faded).
- FE-H2: try/catch around Notification.permission and
Notification.requestPermission and new Notification ctor.
Sandboxed iframes no longer throw on access.
- UX-H1: artifact-body pre / pre code get max-width: 100%,
white-space: pre-wrap, word-break: break-word. Long shell lines
wrap instead of cascading horizontal scroll to panel.
- PERF-H1: marked + DOMPurify dynamic-imported only when user clicks
"+ Show body". First-paint −21 KB gzip.
MEDIUM/LOW:
- FE-M2: clipboard fallback for non-secure contexts (textarea +
document.execCommand('copy')).
- FE-M3: liveText prefixed with zero-width-space + liveSeq counter
so identical breach text re-announces in screen readers.
- FE-M4: notify-on first-fire-storm prevention — prime
prevHealthSnapshot when user flips notify on mid-session.
- FE-L1: prefers-reduced-motion media query covers all *, not just
svg *.
- UX-M1: tooltips on Show downstream / upstream buttons.
- UX-M3: .links ul capped at max-height: 30vh + overflow-y: auto.
- SEC-L1: DOMPurify afterSanitizeAttributes hook adds
rel="noopener noreferrer" to target="_blank" anchors (CWE-1022).
Tests: 68 → 70.
- markdown-renderer.test.ts: target=_blank gets rel=noopener.
- notify.test.ts: iframe-throw fallback returns 'unsupported'.
Verify:
- svelte-check 0/0/436.
- npm test 70/70.
- npm run smoke PASS.
- Playwright DOM check: 0 console errors.
Bundle: 64 KB raw / 21 KB gzip of marked + DOMPurify moved from
first-paint chunk to lazy chunk loaded on body-toggle click.
Refs: PRD-006 RFC-005 PRD-007 RFC-006
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
5-expert audit (TS / Frontend / Security / Performance / UX) on F11+F12+F13 returned 0 CRITICAL, 7 HIGH, ~12 MEDIUM, ~10 LOW. This PR closes all 7 HIGH + 7 MEDIUM/LOW findings.
HIGH
renderBodyreturn type was plainstring— caller could feed any string to{@html}SafeHtml = string & { readonly __safeHtml: unique symbol }marked.parse(...) as stringcast valid only withasync: false— silent breakage if option removed// TODO(marked-types)comment + revisit on marked v19.nodeonly; Matrix has.row-header/.col-header:is(.node, .row-header, .col-header)Notification.permissionaccess throws in sandboxed iframes / restrictive Safari → toggle effect crashedtry/catchinnotificationPermission,requestPermission,fire.artifact-body pre / pre codegetmax-width: 100%; white-space: pre-wrap; word-break: break-wordbodyExpandedbranch — first-paint bundle drops by 21 KB gzipMEDIUM / LOW
execCommand('copy')) for http:// non-secure contexts.liveTextprefixed with zero-width-space +liveSeqcounter so screen readers re-announce identical breach text.prevHealthSnapshotwhen user flips notify on mid-session.prefers-reduced-motionquery extended fromsvg *to*, *::before, *::after..links ul { max-height: 30vh; overflow-y: auto }.afterSanitizeAttributeshook forcesrel="noopener noreferrer"ontarget="_blank"anchors (CWE-1022 guard).Backlog (deferred)
Verify
npx svelte-check— 0/0/436.npm test— 70/70 (68 baseline + 2 new tests for noopener hook + iframe-throw).node scripts/smoke.mjs— PASS.Test plan
max-height: 30vh.Refs:
PRD-006RFC-005PRD-007RFC-006🤖 Generated with Claude Code