Bidirectional PII Engine & Defense-in-Depth Security
7-validator PII masking, Magpie tool loop, netguard anti-SSRF/anti-rebinding, SandboxMediaCSP, and KeyRing cryptography.
Bidirectional AI Privacy Pipeline (internal/privacy)
- 7 Deterministic Validators + User Overlay: Detects
EMAIL,PHONE, GB 11643-1999 checksumID_CARD, LuhnBANK_CARD, context-gatedOTP,SECRETcredentials (API tokens, JWTs, DB URIs, PEM keys), andIP, layered with append-onlyUserPrivacyOverlayrules. - Encrypted Session Maps & 6-Round Tool Loop: Token mappings persist inside AES-256-GCM encrypted Valkey keys (
privacy:sess:*). During multi-step tool calling, Bryfo executesUnmaskJSONlocally for database queries andMaskJSONbefore returning tool results to the model, rehydrating final SSE tokens via digit-boundary-guardedStreamUnmasker.
Socket-Level SSRF & Media Sandboxing
netguard.NewSafeDialContext: Pre-resolves DNS, blocks loopback, RFC 1918, CGNAT (100.64.0.0/10), link-local / cloud metadata (169.254.169.254,fd00:ec2::254), IPv6 ULA (fc00::/7), and multicast CIDRs, dials the validated literal IP directly to defeat DNS rebinding, and re-validates up to 3 HTTP redirects. User BYOK endpoints unconditionally enforceForcePublicOnly: true.SandboxMediaCSP& PDF.js Canvas: Attachments, BIMI icons, and HTML receipts emitContent-Security-Policy: sandbox; default-src 'none'; img-src 'self' data:; style-src 'unsafe-inline'andX-Content-Type-Options: nosniff. SVG, HTML, XML, JS, and PDF forceContent-Disposition: attachment(RFC 5987), while PDFs preview inside a Web Worker<canvas>.
Cryptography, Auth & Immutable Audit Logs
- Argon2id + AES-256-GCM
KeyRing: Passwords hash with Argon2id; third-party credentials encrypt with versionedCREDENTIALS_ENCRYPTION_KEYSand rotate online viabryfo rotate-keys. - TOTP Replay Guard & Trusted Proxies: Stages pending TOTP secrets in Valkey (
10m), blocks 6-digit code replay intotp:used(120s), parsesX-Forwarded-Forright-to-left only fromTRUSTED_PROXIES, and protectssecurity_audit_logswith PostgreSQLDELETE/TRUNCATEtriggers.
System Topology, Storage & Hybrid RAG
Single-binary Go + React architecture, bounded IMAP streaming, SHA-256 blob deduplication, and RRF vector search.
Commercial Ledger & Dual-Currency Economics
Integer minor-unit USD/CNY pricing, append-only dual-pool credit_ledger, fail-closed webhooks, and on-demand IMAP caching.