Chapter 16
Security model
16.1 Layers#
| Layer | Protection |
|---|---|
| Rendering | Values drawn on canvas only; the hidden proxy is reset after every event; untrusted events ignored; autofill, autocorrect, spellcheck and password-manager heuristics disabled on the proxy. |
| Memory | Content stored in SecureBuffer (Uint32Array, zeroed on growth, wipe(), submit, reset, idle, destroy). |
| Secrets | Secret handle: toString/toJSON/inspect print [Secret]; plaintext only via use() or toUtf8(); equals() is constant time. |
| Passwords | No copy/cut, no undo history, auto re-obscure, Caps Lock warning, NFKC. |
| Input | Formatters → sanitiser → allow-list → length cap, on every insertion. |
| Page | Strict CSP without unsafe-eval or inline scripts; no framing; PrivacyScreen. |
| Form | Bot heuristics, client rate limit, double-submit lock, idle wipe. |
| Transport | secureSubmit: same-origin only (or an explicit HTTPS allow-list), CSRF header, redirect: 'error', no-store, no-referrer, timeout. PFE1 encryption of secrets. |
| Server | Host/Origin/Fetch-Metadata checks, HttpOnly + SameSite=Strict session, HMAC CSRF token, JSON-only 16 KB bodies, strict schema, rate limits, peppered scrypt, no secrets in logs or responses. |
16.2 Handling Secret values#
const s = values.password as Secret;
s.length; s.isEmpty; // safe metadata
s.equals(other); // constant time, no strings
s.count((cp) => cp >= 48 && cp <= 57); // inspect code points, no strings
await sealSecret(s, key, 'password'); // preferred way to send it
s.use((plain) => legacyApi(plain)); // last resort: creates an immutable string copy
Never store the argument of use(), never log it, and never put a Secret into application state.
16.3 Honest limits#
- Immutable strings. Anything that creates a JS string (
use(), the visibility toggle,getValue()on normal text fields) leaves a copy that only the garbage collector frees. PixiFormUI minimises that; it can't eliminate it. - Client checks are speed bumps. Bot guard and the client rate limit can be bypassed by a determined attacker. The server is the authority. Add a CAPTCHA/Turnstile on high-value routes.
- XSS is still fatal. Script running in your origin can read memory and patch functions. Keep the CSP strict and keep third-party scripts off pages that use PixiFormUI.
- Password managers. The proxy disables autofill heuristics, so managers can't auto-fill. Pasting is allowed.
- Screen readers can't browse canvas content like a DOM (see §18).