[GH-ISSUE #2577] Harden card CSS sanitizer against escape-sequence evasion in staging (from refactor #2020) #1270

Closed
opened 2026-10-21 05:30:24 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Jun 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2577

Summary

Port the card CSS sanitizer hardening to staging. Shipped to refactor in #2020. staging's current inline <style> sanitizer is the pre-hardening version and shares the same weakness.

Why

staging renders creator-supplied CSS through an inline <style> sanitizer (packages/client/src/components/chat/ChatMessage.tsx). That sanitizer can be evaded via CSS escape sequences, allowing scoped styles to break out of their intended container. #2020 hardened the equivalent sanitizer in refactor; the same hardening should be applied to staging to close the gap.

Scope (Node re-implementation)

  • Harden the existing sanitizer/scoper (escape-sequence normalization before scoping/allow-listing) so styles cannot break out of their scope.
  • Keep changes focused on the sanitizer; no behavior change for well-formed CSS.

Dependencies

None — standalone hardening of the sanitizer already present in staging. (The creator-notes card-CSS port should reuse this hardened sanitizer.)

Reference

  • Source: refactor #2020 — "Harden card CSS sanitizer against escape-sequence evasion"
Originally created by @kolacheee on GitHub (Jun 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2577 ## Summary Port the **card CSS sanitizer hardening** to `staging`. Shipped to `refactor` in #2020. `staging`'s current inline `<style>` sanitizer is the pre-hardening version and shares the same weakness. ## Why `staging` renders creator-supplied CSS through an inline `<style>` sanitizer (`packages/client/src/components/chat/ChatMessage.tsx`). That sanitizer can be evaded via CSS escape sequences, allowing scoped styles to break out of their intended container. #2020 hardened the equivalent sanitizer in `refactor`; the same hardening should be applied to `staging` to close the gap. ## Scope (Node re-implementation) - Harden the existing sanitizer/scoper (escape-sequence normalization before scoping/allow-listing) so styles cannot break out of their scope. - Keep changes focused on the sanitizer; no behavior change for well-formed CSS. ## Dependencies None — standalone hardening of the sanitizer already present in `staging`. (The creator-notes card-CSS port should reuse this hardened sanitizer.) ## Reference - Source: refactor #2020 — "Harden card CSS sanitizer against escape-sequence evasion"
bsakaguchi 2026-10-21 05:30:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1270
No description provided.