Inspiration

Accountants, lawyers, HR teams and doctors hold other people's secrets — and paste them into ChatGPT, Gemini and Claude every day. In one 2026 survey, 79% of workers admitted pasting sensitive data into AI tools. In India, the DPDP Rules start to bite on 13 May 2027, with penalties of up to ₹250 crore. Cloud models reason better; on-device models are private. Hybrid inference finally lets one app use each for what it's good at.

What it does

Veil is a Chrome extension that lives inside ChatGPT, Gemini and Claude. Install it once and it's always on: every time you paste into one of those sites, Veil checks it first — on your device — before the website sees a single character.

  1. Rule packs (India, EU, UK, US) catch IDs instantly — PAN, Aadhaar, GSTIN, IFSC, UPI, IBAN, cards, phone numbers — with checksums and unicode normalisation.
  2. Gemini Nano, on your device, reads the text like a person would: names, places, and quiet giveaways like "the only female cardiologist in Ratnagiri".
  3. Guess Who — Veil attacks itself: a second on-device pass asks "could a stranger work out who this is?" and whatever evidence it cites gets masked too.
  4. Values become smart tags — [PAN_1], [AMOUNT_1 · ₹15–20L] — so the AI can still reason about tax slabs and deadlines. A fail-closed leak gate re-checks the exact payload.
  5. The AI answers with tags; Veil restores the real values on your screen only. ChatGPT, Gemini and Claude never have them. In our live demo, Claude itself replied: "the client's details are masked."

Veil also ships as Veil Studio (web app with a privacy receipt — a SHA-256 of exactly what was sent), a playable Beat Veil game and a Privacy Lens on the landing page, and an on-device benchmark page.

How we built it — Firebase AI Logic hybrid inference

  • getGenerativeModel(ai, { mode: InferenceMode.ONLY_ON_DEVICE }) with JSON-schema responseConstraint for three on-device tasks (names/places, indirect clues, attacker). Sensitive work is deliberately never allowed to fall back to the cloud.
  • getGenerativeModel(ai, { mode: InferenceMode.ONLY_IN_CLOUD }) for reasoning over masked text only; response.inferenceSource is surfaced per stage.
  • In the extension, Gemini Nano runs in an offscreen document through the same Firebase AI Logic code.
  • App Check (reCAPTCHA Enterprise), Authentication (Google), Cloud Firestore (receipt history — security rules accept only counts and a 64-hex hash), Remote Config (cloud model, timeouts, never-mask terms), Hosting.
  • React 19 + Vite + TypeScript + Tailwind 4 + Motion; 82 Vitest (unit, property-based, security) + 21 Playwright tests, including tests that load the real extension.

Challenges we ran into

  • Small on-device models over-mask and paraphrase. We added a merge layer (rules win, protected terms like Form 26AS / AY 2026-27 are never masked, fuzzy re-location of paraphrased spans) and measured utility, not just recall.
  • The attacker's self-reported scores were meaningless, so risk is computed from verified evidence instead.
  • Streaming chat UIs split [PERSON_1] across elements; the extension restores values per block without breaking the page's DOM.
  • Intercepting a paste before the site's own handlers see it — across three very different editors (textarea, contenteditable, ProseMirror).

Accomplishments that we're proud of

  • 98.5% of private items never reached the cloud across a 113-case adversarial benchmark (typos, Hinglish, hidden IDs, CSV/JSON, quasi-identifiers) — vs 69.7% for rules alone. 110 / 113 documents with zero leaks; all 3 leaks happened during an on-device timeout, which Veil flags for review.
  • Works live on ChatGPT, Gemini and Claude; detection keeps working offline.
  • Verified in DevTools that the cloud payload contains zero personal values.

What we learned

Hybrid isn't "on-device as a fallback" — it's a division of labour. Keep anything that sees raw secrets strictly on-device, send the cloud only what it needs to think, and prove it with a receipt.

What's next

Android with Gemini Nano via ML Kit + Firebase AI Logic, more region packs via Remote Config, team policies, and publishing to the Chrome Web Store.

Built on research

PAPILLON (arXiv:2410.17127) · Hide and Seek (arXiv:2309.03057) · Language Models are Advanced Anonymizers (ICLR 2025, arXiv:2402.13846) · Beyond Memorization (ICLR 2024, arXiv:2310.07298)

Built With

  • chrome
  • cloud-firestore
  • fast-check
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-hosting
  • firebase-remote-config
  • gemini
  • gemini-nano
  • javascript
  • motion
  • playwright
  • react
  • recaptcha-enterprise
  • tailwindcss
  • typescript
  • vite
  • vitest
Share this project:

Updates

Submission history