Skip to content

privacyshield-ai/privacy-firewall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PrivacyFirewall Logo

PrivacyFirewall

πŸ‘‹ If you're trying PrivacyFirewall, please star the repo!

It helps others discover the project and motivates development. Takes 2 seconds β†’ ⭐ (top right)

Stop AI Data Leaks Before They Happen
100% Local β€’ Zero Server β€’ Full Control

Chrome Extension ONNX Runtime 100% Local MIT License

PrivacyFirewall Demo


The Problem

Every day, sensitive data gets leaked to AI chatbots:

  • πŸ“§ Customer emails pasted into ChatGPT for summarization
  • πŸ”‘ API keys accidentally included in code snippets
  • πŸ‘€ Employee names shared in meeting notes
  • πŸ’³ Credit card numbers copied from support tickets
  • 🏠 Home addresses in shipping data analysis

Traditional DLP tools don't protect AI chat interfaces. PrivacyFirewall does.


The Solution

PrivacyFirewall intercepts sensitive data before it reaches AI tools β€” running entirely in your browser with no external servers.

Key Features

Feature Description
πŸ›‘οΈ Paste Protection Blocks sensitive pastes with a confirmation modal
⌨️ Real-time Typing Detection Warns as you type sensitive data
🧠 Local AI Detection BERT NER model runs in-browser via ONNX/WASM
βš™οΈ Configurable Rules Enable/disable specific PII types, set block vs warn
🌐 Site Management Protect ChatGPT, Claude, Gemini, Copilot, and more
πŸ”’ Zero Data Transmission Nothing ever leaves your machine

How It Works

graph TD
    A[User Pastes/Types Text] -->|Intercept| B(Content Script)
    B -->|Layer 1| C{Regex Scan}
    C -->|Match Found| D{Block or Warn?}
    D -->|Block| E[πŸ›‘ Show Modal]
    D -->|Warn| F[⚠️ Show Banner]
    C -->|No Match| G{AI Engine Ready?}
    G -->|Yes| H[ONNX Model in Browser]
    H -->|Entities Found| D
    H -->|Clean| I[βœ… Allow]
    G -->|No| I

    style E fill:#dc2626,color:#fff
    style F fill:#f59e0b,color:#fff
    style I fill:#22c55e,color:#fff
Loading

Two-Layer Protection

  1. Instant Regex Layer β€” Catches obvious patterns (emails, credit cards, API keys) in milliseconds
  2. AI Layer β€” BERT Named Entity Recognition detects names, organizations, and locations that regex misses

Both layers run 100% locally in your browser. No Python server. No API calls. No cloud.


Quick Start

Option 1: Download & Install (No Code Required)

Perfect for trying it out β€” takes 30 seconds

  1. Download the latest release:

    Download Extension

  2. Unzip the downloaded file

  3. Install in Chrome:

    • Go to chrome://extensions
    • Enable Developer mode (toggle in top right)
    • Click Load unpacked
    • Select the unzipped folder
  4. Done! Visit ChatGPT and try pasting:

    Contact john.doe@company.com or call 555-123-4567
    

Option 2: Build from Source (For Developers)

Click to expand developer instructions
  1. Clone the repository

    git clone https://github.com/ArnabKar/privacy-firewall.git
    cd privacy-firewall
  2. Build the extension

    cd src/extension
    npm install
    node build.js
  3. Load in Chrome

    • Navigate to chrome://extensions
    • Enable Developer mode (top right)
    • Click Load unpacked
    • Select the src/extension/dist folder

Screenshots

Block Modal
Paste Blocked
Sensitive data detected with highlighting
Warning Banner
Typing Warning
Real-time detection as you type
Popup
Extension Popup
Quick status and settings access
Settings
Settings Page
Full control over detection rules

Detection Coverage

Regex Detection (Instant)

Type Examples
πŸ“§ Email user@example.com
πŸ“± Phone 555-123-4567, +1 (555) 123-4567
πŸ’³ Credit Card 4532-0151-1283-0366
πŸ”’ SSN 123-45-6789
πŸ”‘ AWS Keys AKIAIOSFODNN7EXAMPLE
🎫 JWT Tokens eyJhbGciOiJIUzI1NiJ9...
πŸ” Private Keys -----BEGIN RSA PRIVATE KEY-----
🌐 IP Addresses 192.168.1.1
πŸ“ MAC Addresses 00:1A:2B:3C:4D:5E
🏠 US Addresses 123 Main St, New York, NY 10001

AI Detection (BERT NER)

Entity Type Examples
πŸ‘€ PERSON John Smith, Dr. Sarah Thompson
🏒 ORGANIZATION Acme Corp, Goldman Sachs
πŸ“ LOCATION New York, Silicon Valley

Configuration

Settings Page

Access via the extension popup β†’ Open Settings

  • PII Rules: Enable/disable detection for each type
  • Block vs Warn: Choose blocking modal or warning banner
  • Protected Sites: Manage which AI tools are protected
  • AI Confidence: Adjust sensitivity threshold (0-100%)
  • Behavior: Toggle real-time typing detection

Protected Sites (Default)

  • βœ… ChatGPT (chat.openai.com, chatgpt.com)
  • βœ… Claude (claude.ai)
  • βœ… Gemini (gemini.google.com)
  • βœ… Copilot (copilot.microsoft.com)
  • βœ… Poe (poe.com)
  • βœ… Grok (grok.com)
  • βœ… DeepSeek (chat.deepseek.com)

Architecture

src/extension/
β”œβ”€β”€ manifest.json          # Chrome MV3 manifest
β”œβ”€β”€ background.js          # Service worker (message routing)
β”œβ”€β”€ content-script.js      # Page injection (paste/typing interception)
β”œβ”€β”€ offscreen.js           # AI model execution environment
β”œβ”€β”€ offscreen.html         # Offscreen document container
β”œβ”€β”€ lib/
β”‚   └── transformer-detector.js  # BERT NER model wrapper
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ config.js          # Regex patterns & constants
β”‚   β”œβ”€β”€ scanner.js         # Detection orchestration
β”‚   β”œβ”€β”€ settings.js        # Chrome storage management
β”‚   β”œβ”€β”€ event-handlers.js  # Paste & input handlers
β”‚   └── ui/
β”‚       β”œβ”€β”€ modal.js       # Blocking modal component
β”‚       β”œβ”€β”€ banner.js      # Warning banner component
β”‚       └── styles.js      # Shadow DOM styles
└── ui/
    β”œβ”€β”€ popup.html/js/css  # Extension popup
    └── settings.html/js/css # Settings page

Technology Stack

  • Extension: Chrome Manifest V3, ES Modules
  • AI Runtime: ONNX Runtime Web (WASM)
  • Model: Xenova/bert-base-NER-uncased via Hugging Face Transformers.js
  • UI Isolation: Shadow DOM (no CSS conflicts with host pages)

Privacy & Security

What We DON'T Do

  • ❌ Send data to external servers
  • ❌ Log or store your text
  • ❌ Use analytics or telemetry
  • ❌ Make any network requests (except model download on first run)

What We DO

  • βœ… Process everything locally in your browser
  • βœ… Cache the AI model locally after first download
  • βœ… Store settings in Chrome's encrypted sync storage
  • βœ… Provide fully auditable open-source code

Verify yourself: Open DevTools β†’ Network tab. You'll see zero outbound requests during detection.


Development

Build

cd src/extension
npm install
node build.js

Run Tests

node tests/content-script.test.js

Project Requirements

  • Chrome 120+ (for Offscreen Documents API)
  • Node.js 18+ (for building)

Troubleshooting

"AI Model Loading..." stays forever

  • Check DevTools console for errors
  • The model (~50MB) downloads on first run β€” may take a minute on slow connections
  • Try clearing extension data and reloading

Extension doesn't detect on some sites

  • Check if the site is in your protected sites list
  • Some sites use iframes β€” detection may be limited
  • Open an issue with the site URL

False positives/negatives

  • Adjust AI confidence threshold in settings
  • Some patterns (like short names) may not be detected
  • Report edge cases as issues

Roadmap

  • Firefox/Safari support
  • Custom regex patterns via settings
  • Redaction mode (replace vs block)
  • Export/import settings
  • Keyboard shortcuts
  • Enterprise policy support

Contributing

PRs welcome! Please include:

  • Browser version
  • Steps to reproduce
  • Expected vs actual behavior

License

MIT License β€” see LICENSE


Built for privacy. Runs locally. Open source.
Report Bug β€’ Request Feature