Security Architecture

Last Updated: March 20, 2026

ThunderSweep is a Chrome extension (Manifest V3) that scans Gmail and Google Drive for sensitive documents entirely within the user's browser. No email content, file content, or personally identifiable information is ever transmitted to ThunderSweep servers. This page documents the security architecture, OAuth scope justifications, data flows, and security controls in place.

1. Application Overview

2. OAuth Scope Justification

ThunderSweep requests the minimum OAuth scopes necessary to deliver its core features. Each scope is justified below.

Scope Why It Is Required Why a Narrower Scope Is Insufficient
gmail.readonly Read email metadata (sender, subject, date) and download attachment content for local sensitive-data scanning. No content is stored or transmitted beyond the user's browser. No narrower Gmail read scope exists. gmail.metadata is insufficient because ThunderSweep must download attachment binary content to parse PDFs, DOCX files, and spreadsheets locally for PII patterns.
gmail.modify Required for user-triggered actions: deleting an email or marking it as read directly from the ThunderSweep scan results. ThunderSweep never modifies Gmail without an explicit user action. gmail.readonly alone does not permit delete or label modifications. Users reasonably expect to act on found sensitive emails without leaving the extension. No intermediate scope between readonly and modify exists in the Gmail API.
userinfo.email Identify which Google account is connected so users managing multiple accounts can see which account a scan applies to. No narrower scope for reading the authenticated user's email address exists.
drive Three distinct operations require this scope:
  1. Drive scanning: List and read all Drive files to identify sensitive documents the user uploaded or received.
  2. Vault write: Create the ThunderSweep Vault folder and write AES-256-GCM encrypted files into the user's Drive.
  3. Vault secure-move (delete original): When a user vaults a Drive file, ThunderSweep deletes the original unencrypted copy from Drive after successful encryption — completing a secure move so no plaintext copy remains.
drive.readonly would cover scanning but not Vault write or delete.

drive.file only grants access to files the extension itself created. It does not permit reading or deleting pre-existing user files (uploaded by the user or received via Google Workspace sharing), which is the core use case for both Drive scanning and secure-move.

A combination of drive.readonly + drive.file still cannot delete pre-existing files (only drive or drive.appdata permits this), so the full drive scope is the minimum that satisfies all three operations.

3. Data Flow Architecture

3a. Gmail Scanning

User clicks "Scan" → Background service worker requests Gmail API (HTTPS, OAuth bearer token) → Attachment binary downloaded directly from Google to browser memory → PDF/DOCX/spreadsheet parser runs locally in service worker → Regex patterns match against extracted text → Results stored in chrome.storage.local (metadata only: email ID, subject, detected category) → No content leaves the browser.

3b. Google Drive Scanning

User initiates Drive scan → Background service worker lists Drive files via Drive API → File content fetched directly from Google Drive API to browser memory → Local parsing and pattern matching → Results stored in chrome.storage.local (file name, Drive file ID, detected category — no content) → No content leaves the browser.

3c. Vault Encryption

User clicks "Move to Vault" → File content fetched from Drive to browser memory → AES-256-GCM encryption performed locally using crypto.subtle (Web Crypto API) with a PBKDF2-derived key stored only in chrome.storage.local → Encrypted blob uploaded back to user's Google Drive (ThunderSweep Vault folder) via Drive API → Original unencrypted file deleted from Drive upon confirmation of successful upload → Encryption key never leaves the browser. ThunderSweep servers never receive file content.

3d. TS Share (Optional Encrypted Transfer)

User opts to share a Vault file → File decrypted locally → Re-encrypted with a PBKDF2 key derived from a random 256-bit claim token → Encrypted blob uploaded to Cloudflare R2 bucket (ts-transfer.thundersweep.com) via Worker → Claim token embedded in a one-time link emailed to recipient via Resend (transactional email) → Recipient opens link, claim token sent to Worker, blob downloaded and decrypted in recipient's browser → Blob auto-deleted from R2 within 7 days or on claim, whichever is first → ThunderSecurity LLC cannot decrypt transfer blobs; the claim token is never stored server-side.

3e. Anonymous Feedback (Optional)

User clicks Send on optional feedback form → Message text POSTed to Cloudflare Worker (thundersweep-feedback.lwang-evdy.workers.dev) → Message forwarded to developer email → No email address or account information is included in the request.

4. Security Controls

Content Security Policy

Defined in manifest.json:

"content_security_policy": {
  "extension_pages": "script-src 'self'; object-src 'self'; worker-src 'self'"
}

OAuth Token Storage

Cryptography

Input Validation

Minimum Permissions

No Server-Side User Data

5. Responsible Disclosure

If you discover a security vulnerability in ThunderSweep, please report it privately before public disclosure:


© 2026 ThunderSecurity LLC. All rights reserved. — Privacy PolicyTerms of ServiceData Deletion