-
-
HARshield Workbench: 21 secrets redacted across headers, forms, and JSON responses with live Competitor Gap Audit.
-
Synchronized Dual-AST Diff & Referential Token Lineage: tracing JWT_TOKEN_#1 across login and a 401 Unauthorized payout race.
-
Minimal Repro Bundler: strips 60% static/telemetry noise and exports valid HAR, redacted cURL, Playwright, and Markdown.
-
Real-World Validation: sanitizing Google OAuth ya29 tokens, Slack cookies, and protobuf bodies in a 102 KB mitmproxy HAR.
-
Stage 3.5 Benchmark (12 External HARs): 100.0% secret recall in 78.4ms vs 26.7% Cloudflare regex & 20.0% Chrome scrubber.
-
Four-Layer Client-Side Architecture: Stream Auto-Repair, Recursive MIME AST Walker, FNV-1a Aliasing, Repro Bundler.
Inspiration
Every week, developers, QA engineers, and enterprise customers are asked to attach a .har (HTTP Archive) capture when reporting an API bug or opening a vendor support ticket. Yet raw .har files capture an entire browser session: live session cookies, OAuth access_token and refresh_token strings inside JSON responses, form-encoded passwords, GraphQL variables, and AWS presigned S3 URLs (X-Amz-Signature).
While researching existing tools, we audited the source code and open issue trackers of current HAR scrubbers and found three critical gaps:
- Chrome 130+ Built-in HAR Sanitizer only scrubs top-level
Cookie,Set-Cookie, andAuthorizationheaders (20.0%recall on our 12-file benchmark), leaving 100% of JSON request/response bodies and signed URLs exposed. - Cloudflare's open-source
har-sanitizerruns regular expressions over raw HAR text (26.7%recall). As documented in its GitHub issues, this approach missesapplication/x-www-form-urlencodedPOST fields without trailing delimiters (Issue#17), corrupts valid HAR JSON when headers contain escaped quotes (Issue#22), ignores OAuth tokens inside JSON response bodies (Issue#27), and fails to scrubX-Amz-Signatureparameters at the end of URLs inside JSON strings (Issue#44). - Destruction of Auth Debugging: Naive scrubbers overwrite every credential with identical
[REDACTED]text. When diagnosing a401 Unauthorizedbug caused by a token rotation race condition, replacing both the old token and the new token with[REDACTED]destroys the causal proof.
We built HARshield Workbench to take this problem off the workbench: a 100% client-side, structure-preserving HAR 1.2 AST sanitizer and minimal reproduction bundler.
What it does
- Zero-Egress Local V8 Airlock: Parses and sanitizes
.harfiles 100% inside browser memory (0 Bnetwork egress, self-hosted fonts, zero external API calls). - Recursive MIME & Double-JSON AST Sanitization: Instead of running destructive regexes over raw file strings, HARshield parses the HAR 1.2 JSON tree and recursively unwraps
application/json, stringified JSON-in-JSON envelopes,application/x-www-form-urlencodedbodies,encoding: "base64"JSON responses, JWT payload claims, inlinekey=valueheaders, and embedded presigned URLs. It then recalculatesbodySizeandcontent.sizeso exported.harfiles passJSON.parse()100% of the time. - Referential Token Lineage (
JWT_TOKEN_#1vsJWT_TOKEN_#2): Normalizes credential cores (Bearer <token>and raw<token>in a login JSON response resolve to the exact same token identity) and hashes them with an in-memory FNV-1a session salt. Engineers can clickJWT_TOKEN_#1in the Referential Token Lineage Ribbon to trace every request and response where that exact token wasISSUED,USED, orREJECTED_401. - One-Click Noise Stripping & Minimal Repro Bundler: Strips static font/CSS/image and analytics beacon noise and exports a guaranteed-valid
.sanitized.har, a redactedcurlscript (.sh), an executable@playwright/testAPI specification (.spec.ts), or a Markdown Incident Report. - Truncated HAR Stream Auto-Repair: Large browser
.harexports often cut off mid-entry when saved while background connections are open. HARshield pinpoints the exactLine : Colsyntax error and salvages all complete HTTP entries in one click.
How we built it
- Core AST & Lineage Engine (
src/engine/): Written in strict TypeScript with zero cloud dependencies:harParser.ts: Validates HAR 1.2 schemas, computes line/column diagnostics on malformed inputs, and implements a character-level state-machine scanner (attemptRepairCorruptedHar) to recover complete entries from truncated streams.recursiveSanitizer.ts: Traverses headers, cookies, query strings, and nested MIME payloads, plus runs a live Competitor Gap Audit comparing HARshield against Chrome 131's header scrubber and Cloudflare's regex rules on the user's loaded trace.pseudonymizer.ts: Decodes Base64URL JWT headers/claims locally and maintains a session-salted alias ledger (JWT_TOKEN_#1,OAUTH_TOKEN_#1,PRESIGNED_SIG_#1) across structured and unstructured payloads.reproExporter.ts: Compiles sanitized traces into shell-escapedcurlpipelines, Playwright API tests, and Markdown bug reports.
- Forensic Protocol Workbench UI (
src/App.tsx): Built with React 18, Vite, and Tailwind CSS using a high-density dark analyzer aesthetic (Space Grotesk+JetBrains Mono) with a Synchronized Dual-AST Diff view (Raw Exposurein Crimson vsSanitized Outputin Emerald) and a responsive 3-station390pxmobile layout.
Challenges we ran into
During our real-world validation against external .har captures from open-source repositories (mitmproxy/mitmproxy, Netflix/pollyjs, cloudflare/har-sanitizer, and sitespeedio/coach-core), our initial engine passed 8/12 files (74.1% secret recall) and exposed five real-world edge cases that we subsequently fixed:
- Non-Standard Array Header Values in
Polly.JS:Netflix/pollyjsv1.4.1 serializesset-cookieheader values as a JSON string array (["__cfduid=..."]) rather than a string, which initially threw aTypeErrorduring cookie splitting. Normalizing array header values fixed this completely. - Echoed Credentials in Binary-Text Protobuf Payloads: In
mitmproxy'sdiff_data.har, aclient_idparameter from the URL query string was also echoed inside anapplication/vnd.google.octet-stream-compressiblerequest body alongside a raw email and Google API key. Adding cross-layer propagation (scrubKnownSecretsInUnstructuredText) ensured any secret discovered in structured headers/queries is also scrubbed when echoed in unstructured bodies. - Unquoted Inline Header Key-Value Pairs: Supporting both quoted
key="val"(Cloudflare Issue#22) and unquotedX-Custom-Auth: client_secret=mysupersecret&client_id=app123without regex boundary corruption. - Base64-Encoded & Double-Encoded JSON Payloads: Decoding
encoding: "base64"JSON response bodies and recursively unwrapping stringified JSON objects ("{\"password\":\"...\"}") inside outer JSON envelopes. - Zero-Egress Font Loading in Headless Firefox: Our Playwright Firefox QA suite caught
downloadable font: download failedconsole errors when Google Fonts requests were interrupted on reload. Switching to self-hosted@fontsourceWOFF2 packages eliminated all third-party network calls and fixed the console error.
Accomplishments that we're proud of
- 100.0% Recall (
30/30Secrets) Across 12 Real-World & Benchmark HAR Files: After fixing the edge cases discovered in Stage 3.5, HARshield passed12/12validation datasets (100.0%secret recall,0false positives on clean negative traces, and78.4 msprocessing time on a768 KB50-entry browser capture), compared to26.7%recall for Cloudflare's regex engine and20.0%for Chrome's header scrubber. - Preserving Debugging Signal Without Leaking Secrets: Proving visually and mathematically that
JWT_TOKEN_#1vsJWT_TOKEN_#2referential aliasing lets engineers spot a401 Unauthorizedtoken rotation race condition in seconds. - 24/24 Real-Browser E2E QA Pass: Verified across Desktop (
1440x900) and Mobile (390x844) viewports on both local and deployed builds using headless Firefox with0console errors,0page errors, and0unlabeled controls.
What we learned
- Never Use Raw-Text Regexes on Container Formats: A
.harfile is a JSON document whose string fields (postData.text,content.text) contain nested JSON documents, URL-encoded forms, and URLs. Regexes over the outer file text inevitably either miss nested properties or consume escaping quotes and corrupt the container. - Real External Data Beats Synthetic Happy Paths: Testing against real recordings from
mitmproxyandNetflix/pollyjsimmediately revealed schema dialects (such as array-typed header values and float millisecond timings) that synthetic unit tests alone would never catch.
What's next for HARshield Workbench
- In-Browser Gunzip for
Polly.JS_isBinary: trueHex Arrays: Supporting automaticDecompressionStream('gzip')unpacking for Node.jsPolly.JSrecordings that store compressed hex chunks insideresponse.content.text. - WebSocket Frame (
_webSocketMessages) Inspection: Extending recursive JSON and token lineage sanitization to HAR WebSocket message frames. - Browser DevTools Extension Packaging: Packaging the HARshield AST engine as a zero-permission Chrome/Firefox DevTools panel extension.
Built With
- ast
- devtools
- har
- playwright
- react
- security
- tailwindcss
- typescript
- vite
- vitest