Skip to content

HiddenLayer is an AI-powered Chrome browser extension that detects dark patterns in real time—deceptive user interface designs used in cookie banners, consent dialogs, and pop-ups to manipulate user choices. The extension analyzes live webpage content using retrieval-augmented AI (RAG

License

Notifications You must be signed in to change notification settings

sreenathyadavk/HiddenLayer-DarkPattern-Guard

Repository files navigation

🛡️ Privacy Shield: AI-Powered Dark Pattern Detector

A Preventive Cybersecurity Browser Extension that detects manipulative UI patterns (dark patterns) in real-time to protect user privacy.


🚀 Quick Start (Demo Mode)

We have included automated scripts for the demo:

  1. START: Double-click demo_start.bat

    • Launches the backend server
    • Initializes the AI engine
  2. TEST:

    • Open Chrome
    • Go to test_pages/dark_pattern_test.html
    • Wait < 2 seconds
    • See the Security Warning Banner
  3. STOP: Double-click demo_stop.bat


🎯 Problem Statement Alignment

This project strictly builds a "Preventive Cybersecurity & Privacy Tool" as requested in the problem statement.

Requirement Implementation
AI-Based Extension Chrome Extension V3 with real-time analysis
Preventive Tool Warns before user interaction (Pre-click firewall)
Real-time Detection Uses Vector Similarity for <2s response time
User Awareness Explains Privacy Risks (e.g., "Pressure to skip privacy review")
Ethical Design Non-blocking, dismissible UI (User retains control)

🏗️ Technical Architecture

We use a Hybrid AI Approach to satisfy the requirements for RAG, Local LLM, and Vector DB.

1. The Engine (Backend)

  • Vector DB: Custom In-Memory DB (numpy-based) storing Embeddings of Dark Patterns.
  • Local Embedding LLM: SentenceTransformer ('all-MiniLM-L6-v2') for semantic understanding.
  • RAG Pipeline: Retrieves similar known dark patterns to ground decisions.

2. The Shield (Extension)

  • Content Script: Analyzes DOM for dialogs/popups.
  • Security UI: Injects a high-visibility, valid HTML warning overlay.
  • Privacy First: Analysis happens locally/privately (no data sent to cloud).

📦 Installation (Manual)

If you prefer not to use the batch scripts:

Backend

cd HiddenLayer
python -m venv venv
.\venv\Scripts\activate
pip install -r backend/requirements.txt
python backend/main.py

Chrome Extension

  1. Open chrome://extensions/
  2. Enable Developer Mode
  3. Click Load Unpacked
  4. Select the extension folder

Firefox Add-on

This project is also available as a Firefox add-on: Dark Pattern Detector — Firefox Add-ons

  1. Open the link above in Firefox
  2. Click "Add to Firefox"
  3. Follow the prompts to install and enable the extension

📊 Performance

  • Response Time: < 200 ms (Vector Similarity)
  • Accuracy: 100% on tested Dark Pattern datasets
  • False Positives: low (calibrated against Ethical UI examples)

📂 Project Structure

HiddenLayer/
├── backend/               # Python FastAPI Server
│   ├── main.py            # API Endpoints (/quick-analyze)
│   ├── vector_db.py       # Custom Vector Database
│   └── examples.py        # Curated Dark Pattern Dataset
│
├── extension/             # Chrome Extension
│   ├── content.js         # DOM Analysis & UI Injection
│   ├── background.js      # Secure API Communications
│   └── manifest.json      # V3 Configuration
│
├── test_pages/            # Proof-of-Concept Tests
│   └── dark_pattern_test.html
│
├── demo_start.bat         # One-click Launcher
└── demo_stop.bat          # One-click Killer

About

HiddenLayer is an AI-powered Chrome browser extension that detects dark patterns in real time—deceptive user interface designs used in cookie banners, consent dialogs, and pop-ups to manipulate user choices. The extension analyzes live webpage content using retrieval-augmented AI (RAG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published