Skip to content

vs-cristian/lasso-ext

Repository files navigation

Lasso Extension (Demo)

A demo browser extension for Lasso that watches ChatGPT requests for email addresses and lets you protect them before they are sent.

image image image

What it does

  • Runs on https://chatgpt.com/* and intercepts conversation POST requests.
  • Scans outgoing request bodies for email addresses.
  • Shows a modal with detected emails and decision controls.
  • "Protect Email" replaces detected addresses with [EMAIL_ADDRESS].
  • "Dismiss" hides an email for 24 hours and persists across sessions.
  • Stores decision history and dismissed emails in extension storage.

How it works

  • src/extension/interceptor.ts injects into the page and overrides fetch.
  • src/extension/content.ts renders the UI and bridges messages.
  • src/extension/service-worker.ts performs scanning and persistence.
  • Messages flow via window postMessage and runtime messaging.

Technical data flow (sequence)

sequenceDiagram
  participant Page as ChatGPT Page
  participant Interceptor as Interceptor (page)
  participant WindowBus as Window Messaging
  participant Content as Content Script
  participant Runtime as Runtime Messaging
  participant Worker as Service Worker
  participant UI as Protect Dialog

  Page->>Interceptor: fetch(POST /conversation)
  Interceptor->>WindowBus: EMAIL_SCAN_REQUEST
  WindowBus->>Content: EMAIL_SCAN_REQUEST
  Content->>Runtime: SCAN_EMAIL
  Runtime->>Worker: SCAN_EMAIL
  Worker-->>Runtime: emails + sanitizedBody
  Runtime-->>Content: scan result
  Content-->>WindowBus: EMAIL_SCAN_RESULT
  WindowBus-->>Interceptor: EMAIL_SCAN_RESULT

  alt no emails found
    Interceptor->>Page: allow original fetch
  else emails found
    Interceptor->>WindowBus: REQUEST_DECISION
    WindowBus->>Content: REQUEST_DECISION
    Content->>UI: render dialog
    UI-->>Content: Protect or Send Anyway
    Content->>Runtime: DECISION_RESULT
    Runtime->>Worker: DECISION_RESULT (persist history)
    Content-->>WindowBus: DECISION_RESULT
    WindowBus-->>Interceptor: DECISION_RESULT
    alt protect
      Interceptor->>WindowBus: EMAIL_SCAN_REQUEST (re-scan)
      WindowBus->>Content: EMAIL_SCAN_REQUEST
      Content->>Runtime: SCAN_EMAIL
      Runtime->>Worker: SCAN_EMAIL
      Worker-->>Runtime: sanitizedBody
      Runtime-->>Content: scan result
      Content-->>WindowBus: EMAIL_SCAN_RESULT
      WindowBus-->>Interceptor: EMAIL_SCAN_RESULT
      Interceptor->>Page: fetch with sanitizedBody
    else send anyway
      Interceptor->>Page: allow original fetch
    end
  end
Loading

Notes:

  • Dismissed emails are stored for 24 hours and excluded from scans.
  • Decision history is capped at 200 entries.

Development

Requirements: Node.js and npm.

Install dependencies:

npm install

Start a dev build:

npm run dev

For Firefox:

npm run dev:firefox

Load the extension:

  • Chrome: chrome://extensions -> Developer mode -> Load unpacked -> dist/chrome
  • Firefox: about:debugging#/runtime/this-firefox -> Load Temporary Add-on -> dist/firefox/manifest.json

Build

npm run build

Per-browser builds:

npm run build:chrome
npm run build:firefox

Artifacts:

  • dist/chrome and dist/firefox contain unpacked builds.
  • release/ contains zipped bundles like chrome-lasso-ext-1.0.0.zip.

Project structure

  • src/extension/ content script, interceptor, and service worker.
  • src/components/ UI for the protection dialog.
  • src/lib/ messaging, storage, and domain services.
  • src/types/ shared message types.

Configuration

  • BROWSER=chrome|firefox selects the target in scripts.
  • src/manifest.chrome.ts and src/manifest.firefox.ts define permissions and matches.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published