mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2020] [MERGED] Harden card CSS sanitizer against escape-sequence evasion #5392
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#5392
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/2020
Author: @kolacheee
Created: 6/3/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @cha1latte
Base:
refactor← Head:fix/card-css-escape-sanitizer📝 Commits (1)
7569011Harden card CSS sanitizer against escape evasion📊 Changes
1 file changed (+48 additions, -0 deletions)
View changed files
📝
src/shared/lib/chat-css.ts(+48 -0)📄 Description
Linked issue
Closes #1989
Why this change
src/shared/lib/chat-css.ts) is a regex blocklist over raw text. CSS escape sequences (\XXhex,\c) are decoded by the engine, so a guard that matches literal keyword text can be bypassed by spelling the token with escapes. Examples:\75rl(https://tracker.test)bypasses theurl()network guard,po\73ition: fixedbypasses the overlay guard,--back\67roundbypasses the theme-token blocklist, and:h\61s(re-enables scope probing.What changed
canonicalizeKeywordEscapes(), a string-aware pass at the top ofsanitizeChatCssthat decodes browser-equivalent escapes for token characters before the existing guards run.@, or-, so guards see escapedurl(), at-rules,position: fixed,content,!important, theme tokens, and-moz-bindingas the browser parses them..\32 xland.w-1\/2remain byte-exact.Refactor impact
Primary owner: shared lib (card CSS sanitizer)
Impact areas reviewed:
src/shared/lib/chat-css.ts- change is confined tosanitizeChatCss;scopeChatCssandfilterCssByModebehavior is unchanged.Boundary notes:
Pressure points touched:
src-tauri/src/lib.rscommand registration, or import modules touched.Validation
pnpm typecheck,pnpm build,pnpm check:architecture,pnpm check:docs, or fullpnpm checkwhen warranted)pnpm checkpasses before PR push/handoffManual verification notes
Run locally on the cleaned candidate:
pnpm --dir C:/tmp/marinara-pr-2020-clean exec vitest run src/shared/lib/chat-css.proof.test.ts- clean, 3 proof rows passed from ignored scratch proofpnpm --dir C:/tmp/marinara-pr-2020-clean typecheck- cleanpnpm --dir C:/tmp/marinara-pr-2020-clean check:architecture- clean, no dependency violationspnpm --dir C:/tmp/marinara-pr-2020-clean check- cleanProof rows covered:
url(),@import,:has(),position: fixed,content, and!important.-moz-binding..w-1\/2,.\32 xl, non-theme custom properties, and string contents.Feature Discoverability
src/features/shell/discovery/because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.Reason:
Docs and release impact
README.mdCONTRIBUTING.mddocs/developer/AGENTS.mdUI evidence
N/A - internal sanitizer hardening with no visible UI change.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.