Security
The server is the trust boundary
Anything in the browser can be bypassed: an attacker can post to your endpoint without using the editor. Sanitise on the server when saving and when outputting — see Saving and displaying safely.
Shadow DOM isolates the editor from your page's CSS and scripts; it is not a security boundary.
Two layers, one allowlist
| Layer | When | How |
|---|---|---|
| Browser | Before stored content is shown in the editor | Parsed in an inert document where nothing runs, cleaned, then inserted as nodes |
| Server | On save and on output | symfony/html-sanitizer with PHP 8.4's native HTML5 parser |
Both layers read the same allowlist, so what the editor shows is what the server keeps.
Why PHP 8.4
A sanitiser that reads HTML differently from browsers can be bypassed through the difference (mutation XSS). PHP 8.4's native HTML5 parser builds the same tree browsers do; older parsers were found to disagree on real cases.
How it is tested
The same set of cases — formatting that must survive, and attack payloads
(onerror, javascript: URLs, <svg>/<noscript>/<math> parsing tricks) —
runs in Chromium, Firefox and WebKit, and in PHP, and every environment must
produce the same result.
Image uploads
Uploaded files are identified by their content, SVG is refused, sizes and pixel counts are limited before decoding, and every image is re-encoded, which drops metadata and anything hidden in the file. Uploads require a logged-in user and are rate-limited by default. Details: Image uploads.
Content-Security-Policy
The editor works under a strict policy such as
default-src 'self'; style-src 'self'; script-src 'self': it uses no inline
scripts and styles its shadow tree with constructable stylesheets, which
style-src does not block.
Reporting a vulnerability
Please do not open a public issue. Use GitHub's private vulnerability reporting on the repository, or email support@2bo-velocity.com with "Security" in the subject.