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:

  1. 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 Raw inspection, Split Diff view, and clickable Quarantined tags that scroll and highlight the exact token position in the editor.
  2. 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.
  3. 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).

How we built it

  • Cloud Hybrid Inference (Firebase AI Logic): Integrated firebase/ai (getAI, getGenerativeModel, GoogleAIBackend) in src/config/firebase.ts and src/services/aiService.ts targeting gemini-3.5-flash-lite on the Spark free tier.
  • Client Attestation (Firebase App Check): Integrated firebase/app-check with reCAPTCHA Enterprise (Google Cloud Fraud Defense) on the hosted site (https://localvault-dev.web.app), and localhost-only Debug Provider / CustomProvider support for local development.
  • On-Device AI (Chrome Built-in AI): Wrapped the W3C LanguageModel / window.ai.languageModel Prompt API in src/services/chromePromptApi.ts with singleton session pre-warming, expectedOutputs language 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 (like SuperSecretP@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_TOKEN only runs on localhost while production Firebase Hosting cleanly attests via ReCaptchaEnterpriseProvider required removing a global pre-boot debug flag from index.html and aligning the Fraud Defense site key with the enabled reCAPTCHA 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 enforced Firebase App Check attestation live on https://localvault-dev.web.app with 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

Share this project:

Updates

Submission history