-
-
One record, three views: owner sees all, support a partly hidden email and no note, auditor only that it exists.
-
Document flow: Nano picks passages, code checks policy, you approve the exact payload, then it is hashed and sent.
-
Firebase AI Logic: real values stay on-device with Gemini Nano; cloud Gemini gets only the minimised, masked task.
-
Live EspoCRM test: what was typed (top) and what the CRM stored (bottom): stand-ins and a token, city allowed.
-
Chrome extension (Manifest V3): protects a site without changing it, with host access only where you allow it.
-
Gemini Nano chose 6 of 16 passages on-device. Nothing is sent until you approve.
-
CRM saves run inline: masked and sent at once, while the way back to real values stays in your browser.
-
The whole system: one door between your browser and cloud AI, CRMs and SaaS.
-
A synthetic employment contract with bank, tax and contact details inside.
-
The request Chrome actually sent: the bank account number is replaced by the placeholder [IBAN_1].
Inspiration
People paste contracts, customer records and HR files into cloud AI and SaaS tools with names, bank details and sometimes live API keys inside. On-device models are private but weaker; cloud models reason better but see everything you send. Enterprise data-protection gateways protect fields on the wire by policy, without changing the application. We asked what that looks like in a browser, with Gemini Nano as the local judge and the user as the final approver.
What it does
AIRLOCK is a programmable data-protection boundary for AI and SaaS traffic in the browser. Requests a page makes with fetch and XMLHttpRequest to hosts you list are intercepted before they leave. A plain-JSON profile says which fields matter and what to do with each (allow, mask, surrogate, token, drop, block), a residual scan catches what the profile missed, and deterministic code runs a policy check. Each destination has a mode. AI destinations hold for approval: you see the original beside the exact outbound payload and approve or deny, and only then is it sent, hashed locally. CRM and SaaS destinations run inline: a CRM user must not wait, so the request is masked and sent at once, and what deserves a look lands in a Needs review queue afterwards. Answers return with real values restored, and an audit log records what ran where. A viewer role (owner, support, analyst, auditor) decides how much of a restored value each viewer sees; it is a policy view on one machine, not authentication.
For a Gemini document request, on-device Gemini Nano first picks only the passages the task needs. For a SaaS host with no profile, AIRLOCK masks the request with deterministic detectors, sends it, captures its structure, classifies the real values on-device and authors a profile with hybrid inference from a structure-only prompt; you review it, edit any field and approve before it is saved, and it protects future requests. Without a profile, inline mode catches emails, phones with a country code and keys but not names or free text, and a value the detectors miss is not protected.
It ships as a web app with a six-page console (designed with Google Stitch), a mock CRM stand-in with a Summarize this customer action, and a Chrome extension that was also run against a real self-hosted EspoCRM (not HubSpot), with a side panel and a host list, so it can protect a site that never installs AIRLOCK.
How we used Firebase AI Logic hybrid inference
InferenceMode.ONLY_ON_DEVICEfor every prompt that holds real values: classifying the fields of a held request and choosing the passages of a document. A missing local model throws instead of silently going to the cloud, and if on-device analysis cannot run, nothing is sent.InferenceMode.PREFER_ON_DEVICEfor profile authoring from a structure-only prompt (paths and types, never a value, asserted by code before each call). Nano answers when it can; the SDK falls back to cloud Gemini when it cannot. The panel shows the realresponse.inferenceSourceand latency, and the saved profile records which one wrote it.InferenceMode.ONLY_IN_CLOUDfor the task in the demo app (gemini-3.5-flash-lite), after AIRLOCK has minimized and masked what it sees.initializeDeviceModel()from a user gesture, model status,response.inferenceSourceshown on every AI step, a JSON response schema or constraint on structured calls, and App Check (reCAPTCHA Enterprise on the hosted demo, debug provider locally).- Hybrid is fundamental: the local model decides what the cloud model is allowed to see, and nothing the model says is executed.
How we built it
Vite, React and TypeScript. The engine (profiles, a small JSONPath subset, six protection flows, keyed tokens, vault, policy, adapters for fetch and XHR, structure-only authoring) is plain TypeScript with 329 unit tests. The Chrome extension runs the same engine in the page's world at document_start, with a bridge, a background service worker and a side panel that renders the same console. It uses a few open-source components, including DocCloak.Core's detection rules (Apache-2.0); see NOTICE. The console look was generated with Google Stitch and rebuilt by hand in plain CSS. The project was developed with AI coding assistance (Claude Code).
Measured, not claimed
All data is synthetic. Every number is from a command in the repository (docs/EVAL.md, docs/EVAL-NANO.md, docs/EVAL-QUALITY.md).
- Answer quality against real cloud Gemini (5 tasks, 3 repeats per arm, deterministic fact checks, no LLM judge): the full document sent to the cloud answered 15 of 15; AIRLOCK answered 15 of 15 while sending a mean 1.8 of 16 clauses and 72% fewer bytes, with 0 of 10 sensitive values on the wire against 10 of 10 for the full document. Control gateways that withheld the document or masked every number scored 0 of 13 and 6 of 15, so the metric cannot be gamed by sending nothing. AIRLOCK was slower end to end (median 7.6 s against 3.2 s).
- On-device clause selection over 15 real runs in Chrome: recall 98%, precision 92%, median 3.7 s.
- Masking and policy: 0 of 24 protected values leaked outside four documented weaknesses (4 of 29 including them); 0 of 33 needed values wrongly masked; 8 of 8 injected attack strings blocked; 0 of 3 harmless additions blocked.
Challenges we ran into
- Nano wraps JSON in Markdown fences, is slow on the first call (22.9 s once, then 3 to 4 s), and its first field labels are imperfect (it proposed
allowfor a last name). We added tolerant extraction, a warm-up, and made the per-field edit and the user's approval the real gate. - A profile written by a model is untrusted: it is parsed as data, copied through a whitelist, validated, dry-run and rejected by name when hostile (oversized, out-of-scope host, unsupported locator).
- Fail-closed where it matters: for the AI destination, if the panel is closed, the bridge goes quiet or nobody answers in time, the held request is blocked, not sent. CRM requests are never held, by design.
- The cloud model returned HTTP 500 ("high demand") on some prompts during the evaluation; we report the failures and the redone runs instead of hiding them.
- Staying honest: the evaluations list the cases AIRLOCK misses.
Accomplishments that we're proud of
- A real hybrid pipeline: on-device classification, hybrid authoring, deterministic enforcement, human approval for AI requests, cloud answer, restore.
- The same engine and console in a web app and a Manifest V3 extension, checked in real Chrome 158 against a mock CRM (fetch and XHR, closed panel, host add and remove, a real Nano inspection through the panel), and against a real CRM we do not control: self-hosted EspoCRM in Docker, through EspoCRM's own UI (44 of 44 checks): with a profile, its stored Contact held stand-ins and a token while its own screens showed the real values; without one, names and notes were stored in clear, which is the stated limit. Real on-device Nano classified and authored (and got fields wrong until the user corrected them).
- An independently captured network body hashes to exactly what the console showed.
What we learned
The model should propose and code should decide. A privacy tool must show its misses, and the human edit and approval, not the model's label, are the real gate.
Limits we state plainly
Browser traffic only (fetch and XHR; not beacons, WebSocket or workers). In the extension, the vault of original values lives in the protected site's own localStorage, only one tab is watched at a time, and a hostile page could try to race the handshake (the bridge listens first and a missing bridge blocks). Unverified: Chrome's real permission prompt, the toolbar click, the panel docked in the window, other machines and Chrome versions. One real CRM was tested (self-hosted EspoCRM, one profile, one machine); HubSpot and Salesforce were not tested. A CRM that validates value formats rejects a token, so email and phone use format-valid stand-ins. Search, sort and export on protected values work on stand-ins. Response locators are proposed by code from observed answers and the user confirms them. Values the detectors miss are not protected.
What's next for AIRLOCK
A second real CRM (HubSpot or Salesforce), moving the extension vault out of the page origin, App Check bound to the extension, streaming response restore, and name and address recognition.
What was built during the submission period
The whole project. Pre-existing code incorporated: DocCloak.Core's detection rules, validators and placeholder session (vendored, Apache-2.0, in src/vendor/doccloak). Libraries and fonts are listed in NOTICE and THIRD_PARTY.md. Development used AI coding assistance (Claude Code).
Built With
- chrome
- chrome-prompt-api
- firebase
- firebase-ai-logic
- firebase-app-check
- firebase-hosting
- gemini
- gemini-nano
- libphonenumber-js
- manifest-v3
- pdf.js
- react
- recaptcha-enterprise
- typescript
- vite
- vitest