A Preventive Cybersecurity Browser Extension that detects manipulative UI patterns (dark patterns) in real-time to protect user privacy.
We have included automated scripts for the demo:
-
START: Double-click
demo_start.bat- Launches the backend server
- Initializes the AI engine
-
TEST:
- Open Chrome
- Go to
test_pages/dark_pattern_test.html - Wait < 2 seconds
- See the Security Warning Banner
-
STOP: Double-click
demo_stop.bat
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) |
We use a Hybrid AI Approach to satisfy the requirements for RAG, Local LLM, and Vector DB.
- 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.
- 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).
If you prefer not to use the batch scripts:
cd HiddenLayer
python -m venv venv
.\venv\Scripts\activate
pip install -r backend/requirements.txt
python backend/main.py- Open
chrome://extensions/ - Enable Developer Mode
- Click Load Unpacked
- Select the
extensionfolder
This project is also available as a Firefox add-on: Dark Pattern Detector — Firefox Add-ons
- Open the link above in Firefox
- Click "Add to Firefox"
- Follow the prompts to install and enable the extension
- Response Time: < 200 ms (Vector Similarity)
- Accuracy: 100% on tested Dark Pattern datasets
- False Positives: low (calibrated against Ethical UI examples)
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