specter

Specter

A Chrome extension that records and classifies every network request your browser makes — trackers, analytics, ads, fingerprinting scripts, session replay tools, and more — so you can see (and block) exactly what a site is doing in the background.

Browser-native privacy and tracker analysis powered by fully local ML inference.

Specter is a Chrome MV3 extension that intercepts and classifies network requests in real time — trackers, analytics, fingerprinting scripts, session replay tools, ad infrastructure, and more — entirely on-device using ONNX Runtime + WebAssembly.

No proxy. No cloud inference. No telemetry. No browsing data ever leaves your machine.


Why Specter Exists

Most privacy extensions rely heavily on static blocklists. While effective against known trackers, blocklists struggle with rapidly changing ad infrastructure, newly generated domains, behavioral tracking patterns, and fingerprinting systems that evolve faster than manually maintained signatures.

Specter explores a browser-native alternative:

The project also serves as an experiment in running performant ML systems entirely inside Manifest V3 service worker constraints.


What it does


Architecture

flowchart LR
    A[Chrome Request] --> B[Feature Extraction]
    B --> C[ONNX Runtime Web]
    C --> D[Classification Engine]
    D --> E[Dashboard UI]
    D --> F[Privacy Scoring]
    D --> G[Session Storage]

Runtime Flow

  1. Chrome intercepts outgoing requests using MV3 APIs
  2. Specter extracts lightweight request and domain features
  3. Features are passed into a local ONNX model
  4. Inference executes inside the extension service worker
  5. Results are classified, scored, and surfaced in the dashboard
  6. Sessions are stored locally for later analysis

Detection Pipeline

Specter ships with a pre-trained XGBoost model located at:

extension/data/model.json

The model classifies requests into five categories:

Class Description
legitimate First-party assets, fonts, stylesheets, CDN resources
analytics Analytics and telemetry providers
ad_network Ad exchanges, DSPs, bidding infrastructure
behavioral Cross-site trackers and retargeting systems
fingerprinting Browser fingerprinting scripts and infrastructure

session_replay detection is handled separately using deterministic heuristics.


Feature Engineering

The classifier extracts 27 features per request, including:

Inference executes locally in under 50ms using ONNX Runtime Web.


Model Metrics

Metric Value
Training Samples 25,290 requests
Feature Count 27
Classes 5
Accuracy 96.2%
Weighted F1 0.967
Inference Runtime <50ms
Model Format ONNX JSON
Model Size ~2.4 MB

Technical Challenges

Chrome Manifest V3 Constraints

Manifest V3 replaces persistent background pages with ephemeral service workers, introducing several engineering constraints:

Specter is designed around these constraints while maintaining low-latency request classification.

Browser-Native Inference

Running inference directly inside a browser extension introduces additional challenges:

Specter uses ONNX Runtime Web for efficient local execution without requiring external infrastructure.


Retraining

You can retrain the model locally using your own crawl data.

1. Launch Chrome with remote debugging

npm run chrome

2. Start a crawl session

npm run crawl

3. Export session data

Export sessions from the Specter dashboard and place them into:

tools/exports/

4. Train the model

pip install xgboost scikit-learn onnxmltools numpy
python tools/train.py

Outputs:

extension/data/model.json
extension/data/model_labels.json

The training pipeline:


Data & Privacy

All browsing data remains local to the device.

Specter does not:

Optional VirusTotal lookups are disabled by default and require a user-provided API key.

Local Storage Keys

Key Contents
session:current Active session metadata
requests:{session_id} Classified request objects
scores:{session_id} Per-site privacy scores
sessions:history Session summaries
settings User preferences
blocking:dynamic_domains Domains promoted to DNR block rules
blocking:allowlist Per-site domain overrides
blocking:stats:{session_id} Blocked/stripped counts per session
blocking:daily Calendar-day blocked count for the popup
fp:session_seed (session storage) PRNG seed for fingerprint defense while a session is active

Install

Chrome Web Store

Install directly from the Chrome Web Store.


Development setup

npm install
npm run bundle-libs

Load the extension:

  1. Open chrome://extensions
  2. Enable Developer mode
  3. Click Load unpacked and select the extension/ folder
  4. Pin the Specter icon to your toolbar

The extension ships as plain JavaScript with no frontend build system.

Requirements: Chrome 114+ · Node.js 18+ (build step only)


Usage

Start a session

Click the Specter icon in your toolbar, then click ▶ NEW SESSION. Browse normally. Specter records every request in the background.

Read the live feed

Open the dashboard (OPEN DASHBOARD in the popup). The feed shows each request with its category, domain, confidence score, and size. Click any row to see the full URL, headers, response metadata, and which signals drove the classification.

Network graph

In the dashboard bottom panel, open the Network tab to see a live force-directed graph: your site and third-party domains as nodes, request flow as edges. It respects the same filters and site scope as the timeline. Drag nodes to rearrange, hover for details, click a domain to filter the feed, or export the view as SVG.

Enable blocking

Go to Settings → Blocking and toggle Enable blocking. Blocking is off by default.

With blocking on, Specter:

If a site breaks, click the blocked request in the feed and choose Allow on this site or Allow everywhere to add it to the allow-list.

Review session history

Click the clock icon in the dashboard nav to open Session History. Click any session to see a per-site breakdown with tracker counts and privacy scores. Export a full JSON dump or copy a plain-text report.


Configuration

All settings are in Dashboard → Settings.

Setting Default Description
Autoscroll On Feed scrolls to new rows automatically
Min confidence 0% Hides requests classified below this confidence
Data retention Forever Auto-delete sessions older than N days
VirusTotal API key — Enables domain reputation lookups in the detail panel
Use ML classifier On Switch to rule-based classifier if off
Enable blocking Off Master switch for the blocking engine
Blocking mode Smart Smart (ML-driven) · Strict (all third-party) · Param strip only
Block threshold 85% Confidence required to block in Smart mode
Block session replay On Always block Hotjar, FullStory, LogRocket, etc.
Block fingerprinting On Always block canvas/font/WebGL fingerprint scripts
Block behavioral On Block behavioral trackers above threshold
Block ad networks On Block ad exchanges and bidding infrastructure above threshold
Block analytics Off Block analytics (may break some sites)
Enable fingerprint defense Off MAIN-world noise on canvas/WebGL/audio/navigator/fonts before page scripts
FP defense surfaces All on Per-surface toggles when master switch is on

Project structure

specter/
├── extension/               Chrome extension (load this folder)
│   ├── dashboard.html/js/css
│   ├── graph.js               Network tab (D3 force graph, v1.4)
│   ├── popup.html/js/css
│   ├── blocking-ui.js       Blocking settings UI + feed badges
│   ├── blocking.js          Adaptive blocking engine (DNR rules)
│   ├── fp-defense.js        MAIN-world fingerprint API hooks (v1.3)
│   ├── fp-defense-ui.js     Fingerprint defense settings UI
│   ├── service_worker.js
│   ├── shared.css
│   └── data/
│       ├── blocking_rules.json
│       ├── model.json
│       ├── model_labels.json
│       └── sites.txt
│
├── tools/
│   ├── crawl.js
│   ├── launch-chrome.js
│   ├── train.py
│   └── exports/
│
├── scripts/
│   └── bundle-libs.js
│
└── LICENSE

Roadmap


Contributing

  1. Load the extension unpacked as described in Development setup
  2. Edit files in extension/ — changes take effect after clicking ⟳ in chrome://extensions
  3. The service worker reloads automatically when you restart a session from the popup
  4. No build step for the extension itself — only npm run bundle-libs is needed once
  5. Before opening a PR: npm run bundle-libs && npm run validate (same checks as GitHub Actions CI)

Chrome Web Store uploads run automatically when you publish a GitHub Release whose tag matches extension/manifest.json (see scripts/get-cws-token.md for OAuth setup).

[!NOTE] The extension uses Manifest V3. webRequestBlocking is not available to regular (non-enterprise) MV3 extensions. All blocking is done via declarativeNetRequest. Do not add webRequest blocking listeners — they will be silently ignored.


License

MIT — Divij Agarwal. See LICENSE.