Security
Copy as MarkdownA .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. Ahrefis a#fragment; an image isdata: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,@mediaand@supportsstay.@importis dropped, andurl()isdata:, relative, or the Fontsource CDN. integrity="sha256-..."is checked withcrypto.subtle.digestbefore 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, noFunction, noinnerHTML. Trusted Types ready: the one parse uses a policy namedrupa-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
errorevent to your own monitoring if you want it.
Lock a page to one file
Section titled “Lock a page to one file”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.