Inspiration
Every day, users accidentally paste sensitive credentials, Social Security Numbers, API keys, or financial data into untrusted web forms, phishing pages, and sketchy newsletter popups. Traditional security extensions either rely on static blocklists or send all user text to a third-party cloud server—creating a terrible privacy paradox.
With the launch of Firebase AI Logic and Chrome's built-in Gemini Nano, we realized we could build something revolutionary: an AI bodyguard that inspects what you type on-device in real time, guaranteeing that sensitive keystrokes never leave your browser RAM.
What It Does
InputGuard is an AI privacy bodyguard Chrome extension and web application that watches input fields as you type and intercepts sensitive submissions before they leave your device:
- On-Device Keystroke Sensitivity Classification: Using Gemini Nano 4 via Firebase AI Logic (
InferenceMode.ONLY_ON_DEVICE), InputGuard instantly detects SSNs, credit cards, credentials, API keys, and private data locally with zero network egress. - Real-Time Visual Cues: Risky fields light up with glowing red outlines and an inline
🔴 Danger 🔒 on-devicebadge right next to the form field. - Cloud Site Reputation Fallback: When sensitive data is entered on an unfamiliar or unverified domain, InputGuard routes to Gemini Flash via Firebase AI Logic (
InferenceMode.ONLY_IN_CLOUD) to inspect the domain and title for phishing risks. - Anonymized Security Audit Stream: Zero raw keystroke text is ever recorded. Only anonymized security metadata (domain, category, confidence score, timestamp) is synced in real time to Cloud Firestore.
How We Built It (Firebase AI Logic at Runtime)
InputGuard is engineered with modern Webpack and the Firebase JS SDK (v12+):
- Firebase AI Logic (
firebase/ai): We instantiateGoogleAIBackendand configure generative models with dynamic inference modes:InferenceMode.ONLY_ON_DEVICEis strictly enforced for keystroke and PII detection, ensuring zero data egress.InferenceMode.ONLY_IN_CLOUDhandles deep site reputation queries.- Intelligent heuristic and regex pre-screening fallbacks ensure seamless operation across devices.
- Firebase App Check: Configured with tokens and enterprise attestation to safeguard cloud inference calls against abuse.
- Firebase Authentication: Anonymous sign-in creates an isolated, instant security session without friction.
- Cloud Firestore: Real-time persistence for anonymized incident logs (
{ domain, category, confidence, onDevice, timestamp }). - Firebase Remote Config: Dynamically gates model thresholds and cloud checks at runtime without requiring an extension update.
- Firebase Hosting: Powers the interactive testing sandbox and live landing page.
Challenges We Ran Into
- Manifest V3 Constraints: Chrome's service worker lifecycle and strict Content Security Policies (CSP) required careful bundling of the Firebase JS SDK using Webpack.
- Sub-Second Keystroke Latency: Running AI on active input fields requires instant responsiveness without freezing the DOM. We built a debounced pipeline with fast regex pre-screening to maintain smooth 60 FPS typing.
- Zero-Egress Privacy Boundary: Ensuring no raw text ever crosses into background workers or Firestore required designing strict schema boundaries where only categorical tokens (
SSN,CREDIT_CARD) are persisted.
Accomplishments That We're Proud Of
- A fully working, production-ready Chrome extension using Gemini Nano locally via Firebase AI Logic.
- A true hybrid AI architecture where on-device and cloud models have distinct, non-overlapping responsibilities based on privacy and capability requirements.
- Seamless integration of 6 Firebase products into a unified developer experience.
- An interactive Testing Sandbox (
demo.html) so judges can immediately test phishing simulations with one click.
What's Next for InputGuard
- Android support using Firebase AI Logic for mobile text fields and keyboard extensions.
- Form necessity scoring to detect when legitimate sites ask for excessive data.
- Enterprise fleet policies via Firebase Remote Config to enforce organizational DLP rules across company browsers.
Built With
- chrome
- cloud-firestore
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- firebase-hosting
- firebase-remote-config
- gemini-flash
- gemini-nano
- javascript
- webpack