mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2951] [Issue]: Card-CSS theme-token guard misses --popover/--sidebar and lists a token that doesn't exist #1527
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#1527
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 @kolacheee on GitHub (Jun 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2951
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
Card CSS is blocked from redefining the app's theme color tokens, so a malicious or sloppy card can't repaint the whole app through them. That blocklist has drifted out of sync with the real tokens:
--popover,--popover-foreground, and the base--sidebar— all real, defined, used app tokens — so a card can override them.--sidebar-background, which isn't defined anywhere in the app, so that entry matches nothing.Impact is bounded (card CSS is scoped to the chat container), but it's a real gap in a guard that's meant to be exhaustive, plus a dead entry.
How to reproduce (try it yourself)
<style>::root { --background: red; --popover: red; --sidebar: lime; }#marinara-card-css.You'll see (verified by running the actual sanitizer):
--backgroundis correctly stripped, but--popoverand--sidebarsurvive.Expected: all app theme tokens — including
--popover,--popover-foreground, and--sidebar— are stripped from card CSS.Where it is
packages/client/src/lib/card-css.ts—THEME_TOKEN_BLOCKLISTlines 111-149 (lists--sidebar-backgroundat 130; lacks--popover,--popover-foreground, and bare--sidebar), consumed by the theme-strip pass at 402-408. The tokens are defined inpackages/client/src/styles/globals.css(--popoverline 184,--popover-foreground185,--sidebar200) and consumed via--color-popover: var(--popover)/--color-sidebar: var(--sidebar)(113-114, 128).--sidebar-backgroundis defined nowhere in the stylesheet.What's happening
The token list is hand-maintained and drifted from the actual CSS-variable set, and
--sidebar-backgroundwas never a real token (the app uses bare--sidebar).Suggested fix
Add
--popover,--popover-foreground, and--sidebar(and audit for any other baseglobals.csstokens not listed); drop the non-existent--sidebar-background. Better still: derive the blocklist from the tokens actually declared in the shipped themes, or block any--color-*/ known-prefix custom property, instead of enumerating by hand so it can't drift again.AI-investigated against v2.0.6; reproduced by running the real sanitizer. Please confirm before fixing.
@SpicyMarinara commented on GitHub (Jun 28, 2026):
Fixed on staging: the card-CSS theme-token guard now strips popover/sidebar theme tokens and related color aliases.