Host security guidance
How host applications reduce browser E2EE exposure with CSP, Trusted Types, dependency controls, safe observability, locking, and memory hygiene.
Ownfold keeps plaintext and root keys out of the application server, but it runs inside the host application’s browser origin. Any script executing on that origin while the vault is unlocked can read rendered plaintext or invoke the client. Treat vault routes as a high-security surface.
Browser controls
- Serve only over HTTPS in production. Do not allow mixed content.
- Use a nonce- or hash-based Content Security Policy. Avoid
unsafe-inline,unsafe-eval, broad script hosts, and unreviewed third-party scripts on pages that can unlock a vault. - Require Trusted Types where supported and adopt a reviewed policy instead of scattering bypasses.
- Frame vault pages only where explicitly required. Set
frame-ancestorsand use anti-CSRF controls on every coordination endpoint. - Use Ownfold’s dedicated-worker engine where the host bundler and browser matrix support it.
Worker isolation keeps root-key bytes off the UI thread and reduces accidental exposure, but it
does not protect against malicious same-origin code. Allow only the application origin with
worker-src 'self'.
A starting CSP shape is shown below. Adapt asset, API, development, and framework directives to the host; do not paste it without testing the deployed application.
Content-Security-Policy:
default-src 'none';
script-src 'nonce-{per-response-random-value}' 'strict-dynamic';
style-src 'self';
img-src 'self' data: blob:;
connect-src 'self' https://api.example.com;
font-src 'self';
object-src 'none';
base-uri 'none';
form-action 'self';
frame-ancestors 'none';
require-trusted-types-for 'script'
Supply chain and deployment
Pin lockfiles, review dependency and build-pipeline changes, protect package publication, and keep vault bundles free of tag managers, chat widgets, session replay, advertising, and unnecessary analytics. A compromised application deployment is inside the trust boundary; Subresource Integrity alone cannot repair a compromised first-party bundle.
Plaintext handling
- Keep decrypted values in the narrowest component and shortest lifetime possible.
- Do not place plaintext or root-key handles in global stores, URLs, query caches persisted to disk, server-rendered props, service-worker caches, DOM data attributes, or browser storage.
- Clear form and application state when locking. JavaScript cannot guarantee physical memory erasure, so describe buffer clearing as best effort.
- Avoid clipboard operations. If copying is necessary, make it explicit, warn the user, and clear application-owned references promptly; the browser cannot guarantee clipboard deletion.
- Never use decrypted content for client-side telemetry, crash breadcrumbs, search indexing, or replay recordings.
Safe observability
Bound JSON request and response bodies while streaming them. readBoundedJsonRequest and
readBoundedJsonResponse prevent chunked payloads from being buffered beyond the application’s
explicit limit. Apply a limit to encrypted application-record routes as well as vault coordination.
Record operation names, typed error codes, format versions, key versions, durations, and opaque request identifiers only when necessary. Do not record ciphertext bodies by default: even encrypted payloads expose size and correlation metadata and may be sensitive operational data.
Scrub Recovery Kit contents, recovery passwords, pairing offers, encrypted envelopes, device private material, decrypted values, form fields, and DOM snapshots before they reach logs or error reporters. Disable automatic request-body and browser-session capture on vault routes.
Lock policy
Keep Ownfold’s automatic lock enabled, choose a timeout appropriate to the data sensitivity, and call
recordActivity() only for real user activity not already observed by the browser client. Lock on
explicit sign-out and before switching accounts. Cross-tab locking is defense in depth; malicious
same-origin JavaScript can suppress or reverse it.
Review the threat model, deployment checklist, and unsafe integration examples together.