Insights / Technical notes

Safe User CSS and Public Themes: Shared Source, Scoped Rendering, and Versioned Releases

An anonymized profile-editing design where a shared CSS source of truth can be edited through both a GUI and direct changes. Covers rich CSS syntax within a rendering boundary, drafts and published versions, immutable theme releases, delisting, and operational suspension.

  • CSS
  • Security
  • Web
Safe User CSS and Public Themes: Shared Source, Scoped Rendering, and Versioned Releases
Table of contents
  1. Choose styling freedom and distribution separately
  2. Use one CSS source of truth for the GUI and direct editing
  3. Support rich CSS syntax within the rendering boundary
  4. Separate preview, draft, and publication
  5. Keep another author’s update from changing an active design
  6. Distinguish delisting from operational suspension
  7. What to verify before publication

A profile editor that lets people adjust colors and spacing in a GUI and edit the overall layout with CSS needs to address both usability and the safety of code shown on public pages. This anonymized implementation illustrates the boundaries between editing and distribution.

Choose styling freedom and distribution separately

For personal editing, first test scope containment and save conflicts. Distribution to others also needs fixed version IDs, usage terms, and a default appearance after suspension. Use a small theme with Grid and pseudo-elements to check unchanged outer navigation and stability of applied versions after author updates.

W3C Selectors:Checking selector scope

Use one CSS source of truth for the GUI and direct editing

In a later expansion, the full CSS became the theme’s source of truth, and the GUI was changed to edit the same CSS declarations. Handwritten comments, declarations the GUI does not manage, and responsive rules are preserved. The older format with GUI settings and additional CSS is carried forward into an editable full stylesheet. Changing only helper settings used to display a settings list does not mean the CSS used for rendering has changed.

The backend and frontend expansions were each merged into their main branch, and CI and implementation tests were checked. Within this audit scope, that is not proof of production delivery or of an end-to-end workflow tested by a logged-in user.

Support rich CSS syntax within the rendering boundary

The initial limits based on a small property allowlist were expanded to cover Grid and Flex, variables, gradients, pseudo-elements, transforms, animations, and rules such as @media, @supports, and @container. This does not mean arbitrary CSS is inserted without inspection. The syntax tree is parsed, and every selector branch is confined to descendants of the designated profile region. The same boundary is applied inside conditional rules; outer operator controls and license displays are outside the theme’s scope. W3C Selectors is a starting point for the selector specification.

Variable and keyframe names are rewritten to unique names in published CSS to avoid interference with variables in the outer interface or animations from another theme. The original names remain available for editing. Containment and isolation on the outer rendering wrapper further confine the effects of broad layout rules to the profile region.

External resource fetching, global rules such as @import and @font-face, unparsable syntax, CSS nesting, the HTML style terminator, and animation references whose names cannot be resolved safely are rejected. Input and generated output sizes are also checked. On publication and when loading a snapshot, the scope, unique names, and validated canonical CSS string are checked again for consistency. Supporting a broad syntax does not guarantee identical rendering in every browser.

Separate preview, draft, and publication

Trying on or applying a theme changes a draft. The public page does not change until the owner publishes it. Being able to edit handwritten CSS again is also different from exposing that original source to visitors. The save contract detects conflicts and prevents a retried operation from duplicating a version or draft update.

Keep another author’s update from changing an active design

A theme’s editable listing information is separated from its immutable versions. A user imports a specific version ID; when the author releases a new version, existing drafts and published versions do not change automatically. The source and version applied, along with the source of the usage terms, remain attached after editing. If a public profile becomes private again, the author’s draft name and image must not leak into the distributed theme.

Distinguish delisting from operational suspension

An author delisting a theme stops new discovery and application, but does not necessarily revoke existing uses of a pinned version immediately. Suspending a dangerous theme operationally has a different boundary: public retrieval and CSS from existing snapshots are stopped, and the standard appearance is restored. Even when rolling back to an older snapshot, the current suspension state is checked so that CSS from before suspension cannot be revived.

From CSS editing to a fixed release Code integration, CI, and production delivery of the earlier Store version were checked. Production/login acceptance of the CSS expansion, user application, and paid sales are unverified.
  1. Shared CSS source The GUI and direct editing use the same CSS source and preserve hand-written rules.
  2. Parse and scope Support Grid/Flex, variables, pseudo-elements, responsive rules, and animation. Reject external, global, or unparseable input.
  3. Publish an explicit version Publish an immutable version after preview/draft. Delisting and operational suspension are separate.

What to verify before publication

Check out-of-scope selectors, external requests, input size, save conflicts, retries, an author’s profile becoming private, delisting, operational suspension, and rollback. Production delivery of the fixed-version store and display of test data were confirmed, but production delivery and logged-in acceptance of the CSS editing expansion remain unconfirmed within this audit scope. The public theme count was zero at an earlier check; this is not a statement of the current count. An end-to-end test of real users submitting and applying themes, and paid sales, have not been demonstrated. Usage terms cannot guarantee that CSS delivered to a browser will never be copied.

For the input side of editing, see draft import of profile information; for CMS operations, see the Sveltia CMS guide.