Security & Threat Model
GatherGate is designed for practices handling regulated identity, tax, financial, and clinical records on their own infrastructure.
Protections Built In
Section titled “Protections Built In”1. Per-Record Encryption at Rest
Section titled “1. Per-Record Encryption at Rest”- Uploaded files, sensitive text fields, client notes, workspace email credentials, and webhook signing secrets are encrypted with AES-256-GCM.
- Every record derives its own unique 256-bit key via HKDF-SHA256 from
MASTER_KEYand binds the ciphertext to its record/workspace ID using authenticated additional data (AAD). - Tampering with ciphertext or swapping encrypted values across rows fails authentication immediately.
- Uploaded blobs record
enc_version = "v1"in SQLite for future key-rotation workflows.
2. Fail-Closed Magic-Byte File Sniffing
Section titled “2. Fail-Closed Magic-Byte File Sniffing”Every upload is inspected by binary signature (src/security/magic-bytes.ts), never just file extension or Content-Type:
- Allowed:
PDF,PNG,JPEG,WebP,DOCX,XLSX,CSV,TXT. - Blocked: Spoofed executables, HTML/JavaScript masquerading as images, HTML/script tags disguised as CSV/TXT, arbitrary ZIPs, and SVG workspace logos (preventing stored XSS via embedded
<script>).
3. Sandboxed Previews & Strict Headers
Section titled “3. Sandboxed Previews & Strict Headers”- Decrypted operator document previews stream with
Content-Security-Policy: default-src 'none'; sandboxandX-Content-Type-Options: nosniff. - Local Outbox HTML previews render inside empty-sandbox iframes (
sandbox=""). - Magic-link portal responses send
Referrer-Policy: no-referrerso client tokens never leak to external links.
4. Authentication, OTP & Rate Limiting
Section titled “4. Authentication, OTP & Rate Limiting”- Operator passwords use native Node.js Argon2id (
19 MiB, 2 passes;scryptfallback on Node 22). - Optional 6-digit Email OTP enforces expiry, single-use invalidation, and immediate 5th-attempt lockout (
429). - Fixed-window per-IP and per-token rate limits protect login, OTP, and upload endpoints (
429+Retry-After). - Every operator query and route is scoped by
auth.workspace.idwith cross-tenant IDOR regression tests.
5. Scoped API Keys, Metadata-Only MCP & Outbound SSRF Guards
Section titled “5. Scoped API Keys, Metadata-Only MCP & Outbound SSRF Guards”- Workspace API keys (
gg_live_...) are stored strictly as SHA-256 hashes, enforce per-scope least privilege (templates:read,requests:read,requests:write,mcp:read), and block session-only routes (Settings, API key management, sensitive ID reveal, downloads, andexport.zip). Read-only (requests:read) keys redactportal_url/portalUrlunlessrequests:writeis also granted. POST /mcpis Bearer-only (rejecting browser cookies), validatesOriginheaders, and returns pack metadata only (never raw files, client notes, submitted text values, workspace secrets, or magic-link tokens).- Outbound webhooks enforce
redirect: "error"and, underMULTI_TENANT=true, block private/loopback/link-local IPv4 and IPv6 ranges with DNS-pinned connections for both webhooks and workspace SMTP.
6. Automated Retention & Purging
Section titled “6. Automated Retention & Purging”Completed packs schedule automatic cryptographic blob deletion and sensitive field erasure (purge_at), defaulting to 14 days when sensitive national ID validators are present and 30 days otherwise. Prior webhook_deliveries payloads are shredded before dispatching the minimal request.purged metadata event.
Out-of-Scope Threat Boundaries
Section titled “Out-of-Scope Threat Boundaries”- Compromised host or
MASTER_KEY: An attacker with root shell access or read access toMASTER_KEYcan decrypt stored records. KeepMASTER_KEYin a secret manager or hardened environment config. - Forwarded non-OTP magic links: Anyone holding an open magic-link URL can view and submit items until locked or expired. Enable Email OTP on requests collecting tax, identity, or medical records.
- Client-side PDF/Office viewer bugs: GatherGate verifies file signatures and sandboxes inline previews, but does not run antivirus scanning or content disarm and reconstruction (CDR).
Vulnerability Disclosure
Section titled “Vulnerability Disclosure”Do not open public GitHub issues for security bugs. Use GitHub Private Vulnerability Reporting on FAAS19/gathergate or email contact@tensorforge.dev.