Inspiration
Every day, developers and operations engineers paste crash logs, stack traces, and API JSON payloads directly into cloud LLMs to troubleshoot production bugs. In the process, live API keys, database connection passwords, JWT bearer tokens, credit card numbers, and customer PII are silently transmitted to remote servers—creating severe security, compliance (GDPR/HIPAA/SOC2), and credential-exposure risks.
I built LocalVault Dev to solve this with a Local-First Privacy Firewall & Hybrid AI Debugger: on-device guarantees absolute control over raw secrets; the cloud provides deep architectural reasoning.
What it does
LocalVault Dev enforces a strict 3-stage Hybrid AI pipeline inside the browser:
Instant On-Device Sanitization (<1ms):
- Detects and quarantines 10+ categories of sensitive credentials and PII (OpenAI/Anthropic/Stripe/GitHub/GitLab/Slack keys, JWTs, AWS/GCP tokens, bcrypt hashes, database URI passwords, credit cards, emails, phone numbers, and internal IPs) strictly inside local browser memory.
- Replaces raw secrets with type-safe scalar placeholders (e.g.,
[REDACTED_API_KEY_1],[REDACTED_PASSWORD_1]) while keeping live editor synchronization,Reveal Rawinspection,Split Diffview, and clickable Quarantined tags that scroll and highlight the exact token position in the editor.
On-Device AI Triage & Modeling (Chrome Gemini Nano + Fast 5ms Fallback):
- Uses Chrome's Built-in AI (
LanguageModel/ Prompt API) with silent background pre-warming and token-by-token streaming (promptStreaming) for zero-egress log triage. - Includes a dual-engine toggle to switch seamlessly to a Fast 5ms deterministic local AST engine—generating sanitized TypeScript interfaces in the JSON to Model tab or working smoothly on any browser without Gemini Nano downloaded.
- Uses Chrome's Built-in AI (
0-Leakage Privacy Gate & Cloud Deep Reasoning (Firebase AI Logic):
- Before any cloud call leaves the browser,
LocalSanitizer.verifyZeroLeakage()performs a mandatory pre-flight security check and aborts execution if any unmasked secret remains. - Once verified, only sanitized
[REDACTED_*]buffers are dispatched via Firebase AI Logic (gemini-3.5-flash-lite) protected by Firebase App Check, returning structured Root Cause Analysis, Actionable Remediation steps, Firewall Security Advisories, and mitigation code snippets (with a resilient local Demo Shield fallback if offline).
- Before any cloud call leaves the browser,
How we built it
- Cloud Hybrid Inference (
Firebase AI Logic): Integratedfirebase/ai(getAI,getGenerativeModel,GoogleAIBackend) insrc/config/firebase.tsandsrc/services/aiService.tstargetinggemini-3.5-flash-liteon the Spark free tier. - Client Attestation (
Firebase App Check): Integratedfirebase/app-checkwith reCAPTCHA Enterprise (Google Cloud Fraud Defense) on the hosted site (https://localvault-dev.web.app), and localhost-only Debug Provider /CustomProvidersupport for local development. - On-Device AI (
Chrome Built-in AI): Wrapped the W3CLanguageModel/window.ai.languageModelPrompt API insrc/services/chromePromptApi.tswith singleton session pre-warming,expectedOutputslanguage attestation (en), and streaming delta handling. - Frontend & Hosting: Built with React 19, TypeScript, Tailwind CSS, and Vite, deployed on Firebase Hosting.
- Testing: Validated with a 52-test Vitest suite covering adversarial regex edge cases, false-positive prevention, JSON structural integrity, AST modeling, and physical egress blocking.
Challenges we ran into
- Adversarial Credential Edge Cases: Passwords containing
@inside PostgreSQL/MongoDB URIs (likeSuperSecretP@ssw0rd!2026) initially risked being split and misclassified as email addresses, and overlapping patterns (credit cards vs. phone numbers, UUIDs vs. hex secrets) caused false positives. I solved this with occupied-range tracking, zero-width boundary assertions, and order-of-precedence rules verified by 37 sanitizer unit tests. - Stale Highlight Offsets During Live Edits: Clicking a quarantined tag after editing or deleting text in the editor initially used stale character offsets. I replaced static indices with dynamic live lookup (
indexOf) and real-time entity resynchronization. - Production App Check Separation: Ensuring
FIREBASE_APPCHECK_DEBUG_TOKENonly runs onlocalhostwhile production Firebase Hosting cleanly attests viaReCaptchaEnterpriseProviderrequired removing a global pre-boot debug flag fromindex.htmland aligning the Fraud Defense site key with the enabledreCAPTCHA Enterprise API.
Accomplishments that we're proud of
- Zero-Leakage Guarantee: Mathematically enforced pre-flight egress blocker backed by 52 passing automated unit tests (
npm test). - True Hybrid AI on Spark Free Tier: Combines Chrome Gemini Nano on-device streaming with
Firebase AI Logic(gemini-3.5-flash-lite) and enforcedFirebase App Checkattestation live onhttps://localvault-dev.web.appwith zero billing required. - Polished Developer UX: Instant visual diffing, one-click tag-to-editor locating, 4 realistic developer incident presets, and live runtime module health inspection in the Firebase Setup modal.
What we learned
Hybrid AI is not just a latency or cost optimization—it is a security boundary. Running redaction and fast triage locally while reserving cloud Gemini models strictly for sanitized structural reasoning makes AI debugging practical even for sensitive enterprise workflows.
What's next for LocalVault Dev
- Package the sanitizer + 0-Leakage Gate as a Chrome Extension and VS Code Extension to protect developers inside existing web AI chats and IDEs.
- Add user-configurable regex/secret rules and team-shared sanitization presets.
Built With
- chrome-built-in-ai
- firebase
- firebase-ai-logic
- firebase-app-check
- firebase-hosting
- gemini
- gemini-nano
- google-cloud
- react
- recaptcha-enterprise
- tailwindcss
- typescript
- vite
- vitest