Skip to content

nate-griff/chrome-cookie-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

chrome-cookie-exporter

A Manifest V3 Chrome extension for academic research that automatically captures all cookies for the active tab's domain on every page load and POSTs them as JSON to a configurable endpoint.


Project Structure

chrome-cookie-exporter/
├── manifest.json            # MV3 manifest — permissions, service worker, popup, options
├── config.js                # Single source of truth: ENDPOINT_URL + storage key constants
├── background.js            # Service worker: tab listener → cookie fetch → POST → notify
├── popup/
│   ├── popup.html           # Toolbar popup — last export domain, status, count, timestamp
│   └── popup.js             # Reads chrome.storage.local and renders export status
├── options/
│   ├── options.html         # Settings page — toggle for debug notifications
│   └── options.js           # Loads/saves settings via chrome.storage.sync
├── icons/
│   ├── icon16.png           # Toolbar icon (placeholder)
│   ├── icon48.png           # Extensions page icon (placeholder)
│   └── icon128.png          # Web Store / install icon (placeholder)
└── README.md

Setup

1. Configure the endpoint

Open config.js and set ENDPOINT_URL to your collector server:

export const ENDPOINT_URL = "https://your-collector-server.example.com/collect";

2. Load the extension in Chrome

  1. Open Chrome and navigate to chrome://extensions
  2. Enable Developer mode (toggle in the top-right corner)
  3. Click Load unpacked and select the chrome-cookie-exporter/ folder
  4. The extension icon will appear in the toolbar

3. Verify it's working

  1. Navigate to any http/https page
  2. Open chrome://extensions → find Cookie Exporter → click Service WorkerInspect
  3. In the Console, confirm a POST is made to your endpoint
  4. Click the toolbar icon to see the popup showing the last export's domain, status, and cookie count
  5. Check your collector server to confirm it received the expected JSON payload:
{
  "domain": "example.com",
  "url": "https://example.com/page",
  "timestamp": "2026-03-02T12:00:00.000Z",
  "cookies": [ /* chrome.cookies.Cookie[] */ ]
}

Debug Notifications

A system notification ("Cookies Exported — N cookie(s) from domain.com") can be shown every time an export runs. This is off by default.

To enable:

  1. Click the toolbar extension icon
  2. Click Settings in the bottom-right of the popup
  3. Toggle Export notifications on and click Save Settings

To disable: toggle it back off via the same settings page.


Roadmap

Phase 1 — Core ✅

  • manifest.json (MV3), config.js, background.js
  • Auto-export all domain cookies on every page load (tabs.onUpdatedstatus: "complete")
  • POST JSON payload { domain, url, timestamp, cookies[] } to ENDPOINT_URL

Phase 2 — Feedback UI ✅

  • Toolbar popup — shows last export: domain, status (success/error), cookie count, timestamp
  • Options/settings page — debug notification toggle (off by default)
  • Debug system notification: "N cookie(s) exported from domain" after each export

Phase 3 — Robustness

  • Retry logic with exponential back-off on POST failure
  • Persistent error log accessible from the popup
  • Deduplication — skip POST if cookies are unchanged since the last export for the same domain

Phase 4 — Filtering

  • Domain allowlist/denylist configurable in config.js and/or the options page
  • Optional cookie name filter (regex or prefix match)

Phase 5 — Research Tooling

  • Companion collector server spec (Node/Express) — appends to JSONL or SQLite
  • Export history viewer — browse past exports from the popup
  • CSV/JSON download of stored exports

Permissions Used

Permission Reason
cookies Read all cookies for a given domain
tabs Detect page load completion and get the tab URL
storage Persist last export result (local) and settings (sync)
notifications Show optional debug export notifications
<all_urls> (host) Required to read cookies across all domains

Notes

  • Built on Manifest V3 — MV2 is deprecated and being phased out of the Chrome Web Store.
  • The extension fires on every http/https page load. It silently skips chrome://, file://, and other non-web URLs.
  • Icon files in icons/ are placeholders. Replace with proper artwork before distribution.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors