How to Scrub JWTs, API Keys & Cookies Before Pasting Logs into Cursor or Claude
The Most Common Way Production Secrets Leak Today
Developers rarely paste .env files into public issues on purpose. Instead, secrets leak sideways during rapid debugging: a failing fetch request returns HTTP 401 or 500, you copy the request headers, URL query string, or console payload into ChatGPT, Claude, Cursor, or a GitHub issue, and buried inside that dump sits a live Authorization: Bearer eyJ... JWT, an x-api-key header, a session Cookie, or a customer email address.
Once pasted into an external chat or ticket tracker, rotating leaked tokens across staging and production consumes hours of incident response and triggers security audits. The safest workflow is to scrub sensitive patterns automatically in local memory before the diagnostic text ever reaches your clipboard.
Which Patterns Should Be Scrubbed Automatically?
A practical local sanitizer must inspect every layer of a browser bug report: page URL query parameters, console error messages, stack traces, request headers, and JSON response previews. Relying on a single regex for Bearer misses secrets passed inside JSON bodies, OAuth redirects, webhook callbacks, or custom authentication header keys.
Whenever an API client falls back to query-string tokens or logs serialized request config objects on failure, sensitive fields show up in multiple formats at once. Covering token prefixes, header names, and structured key-value pairs ensures nothing slips into your AI chat history.
- JSON Web Tokens (eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+).
- Authorization headers (Authorization: Bearer ... and Authorization: Basic ...).
- Provider API keys (sk-, sk-proj-, sk-ant-, ghp_, github_pat_, AKIA..., sk_live_, rk_live_, xoxb-).
- Session and auth headers (Cookie, Set-Cookie, x-api-key).
- Sensitive JSON and query keys (password, secret, access_token, refresh_token, client_secret) plus PII email addresses.
Client-Side Scrubbing + Visual Screenshot Blackout
Running the scrubber locally in browser memory guarantees that raw secrets never leave your device—even to generate a bug summary. However, text scrubbing alone is only half the battle when a bug report includes a screenshot showing a logged-in admin email, billing ID, or API key on screen.
Pairing local regex scrubbing with permanent #000000 pixel blackout on the accompanying PNG screenshot closes that gap completely. When you drag blackout boxes over sensitive UI regions on the canvas before export, the underlying pixels are overwritten permanently—never hidden under reversible CSS overlays.
// Example local sanitization pass replacing known secret patterns
function redactSensitiveText(input) {
return input
.replace(/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g, '[REDACTED]')
.replace(/(Authorization\s*:\s*(?:Bearer|Basic)\s+)[^\s,;]+/gi, '$1[REDACTED]')
.replace(/\b(?:sk-(?:proj-|ant-)?|ghp_|github_pat_|AKIA|sk_live_|rk_live_|xoxb-)[A-Za-z0-9_\-]{10,}\b/g, '[REDACTED]')
.replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, '[REDACTED]');
}
A Repeatable 3-Step Pre-Share Verification Habit
Before dropping any diagnostic dump into an AI prompt, GitHub Issue, or Linear ticket, verify three details locally so security stays automatic rather than an afterthought. Adopting a consistent pre-share gate takes less than five seconds and protects both customer PII and internal service credentials across fast-moving sprint cycles:
First, always inspect the scrub summary counter before copying text so you know exactly how many tokens were caught. Second, verify whether sensitive customer names, billing totals, or internal dashboard IDs appear visually in the viewport capture. Third, prefer sanitized Markdown presets or checksummed offline ZIP bundles over ad-hoc raw DevTools copy-pastes.
- Check the secret scrub summary first: ReproVault runs its local detector on every capture—even on the Free tier—and displays exact counts of scrubbed JWTs, API keys, Bearer tokens, cookies, emails, and failed requests.
- Black out visible account identifiers or PII on the screenshot canvas with irreversible #000000 rectangles before saving.
- Avoid pasting raw cURL commands copied straight from Chrome DevTools Network tab, as they embed full Cookie and Authorization headers by default.
- Export via one-click Cursor / Claude, GitHub, or Linear Markdown presets—or bundle screenshot.png, diagnostics.json, repro.md, and sha256_manifest.txt into a local ZIP pack with a $15 Early Bird Pro license.