mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2425] [MERGED] Strip style attribute from game AnimatedText sanitizer #5603
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#5603
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2425
Author: @Romuromylus
Created: 6/6/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/animatedtext-no-style-attr📝 Commits (1)
4160809Strip style attribute from game AnimatedText sanitizer📊 Changes
2 files changed (+39 additions, -3 deletions)
View changed files
📝
src/features/modes/game/components/AnimatedText.tsx(+5 -3)📝
src/styles/globals.css(+34 -0)📄 Description
Linked issue
Closes #2367
Why this change
AnimatedTextrenders raw model choice/map text and allowed thestyleattribute in its DOMPurify config. Model output could therefore injectstyle="position:fixed;background:url(...)"— a CSS-exfil beacon (the URL fires on render;tauri.conf.jsonhassecurity.csp = null) or a clickjacking overlay. The siblinggame-narration-format.tsalready allows only["class"].What changed
src/features/modes/game/components/AnimatedText.tsx: dropped"style"from both DOMPurifyALLOWED_ATTRarrays (the componentuseMemoandanimateTextHtml), so they now allowclassonly — matching the sibling narration formatter.anim-text-wave-char-0…9(char index mod 10) insrc/styles/globals.css, so the wave animation is unchanged while arbitrarystyleis stripped.Refactor impact
Primary owner: game mode
Impact areas reviewed:
src/features/modes/game/components/AnimatedText.tsx(both sanitizer configs + wave wrapping)src/styles/globals.css(wave-delay buckets)Boundary notes:
stylecarriers in this component were the attacker vector and the wave delay (now class-driven). No Rust touched. Mod-10 bucketing is identical for ≤10-char wave spans and cosmetically repeats the cascade for longer spans.Pressure points touched:
Validation
pnpm checkpasses before PR push/handoffManual verification notes
pnpm vitest run(jsdom AnimatedText) — local-only tests confirmed a maliciousstyle="position:fixed;background:url(evil…)"choice string renders with nostyleattribute / noposition:fixed/ no beacon URL in the DOM (text content preserved), and the per-char wave spans still carry theiranim-text-wave-char-Ndelay classes with no inline style.pnpm exec tsc -b— clean.Feature Discoverability
src/features/shell/discovery/Reason:
Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.