Skip to content

Security

Copy as Markdown

A .rupaplay file is data that comes from somewhere else, so it is treated as untrusted.

  • The markup is parsed by DOMParser (inert), then rebuilt node by node from an allow-list of elements and attributes into a new fragment. Nothing is serialised and parsed again. Never written: script, iframe, object, embed, foreignObject, style, link, meta, base, form, on* attributes. A href is a #fragment; an image is data:image/*, https: or relative.
  • The CSS goes into a constructable stylesheet (inert, allowed by a strict CSP, no inline <style>). Its rules are walked and only styles, @keyframes, @font-face, @media and @supports stay. @import is dropped, and url() is data:, relative, or the Fontsource CDN.
  • integrity="sha256-..." is checked with crypto.subtle.digest before the file is unpacked. The download is limited to 25 MB and the unpacked file to 50 MB (counted while it streams, so a decompression bomb is cut). Cross-origin requests carry no credentials.
  • No eval, no Function, no innerHTML. Trusted Types ready: the one parse uses a policy named rupa-player.
  • Every entry point (a listener, a timer, an observer, a promise continuation, a lifecycle callback) runs inside a guard, so an internal error makes one player inert instead of breaking the page.
  • No telemetry. Forward the error event to your own monitoring if you want it.

Add the hash of the exported file. The player refuses a file that was changed, and you update the value after every re-export.

<rupa-player src="/hero.rupaplay" integrity="sha256-..."></rupa-player>

The check needs a secure context (https or localhost). Report a vulnerability privately: see the contributing guide in the package repository.