Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 6 min read

I Reverse-Engineered 50 Production Web Apps. Here Is What AI Coding Agents Actually Need to Map Any Bundle in 60s.

Last Tuesday, an engineer on our team was trying to understand how a popular collaborative canvas app implemented its real-time multi-cursor sync. He pasted the app's URL into Claude Code and Cursor and typed the prompt

I Reverse-Engineered 50 Production Web Apps. Here Is What AI Coding Agents Actually Need to Map Any Bundle in 60s.

Last Tuesday, an engineer on our team was trying to understand how a popular collaborative canvas app implemented its real-time multi-cursor sync.

He pasted the app's URL into Claude Code and Cursor and typed the prompt almost every developer is using right now:

"Reverse-engineer this web app, explain its architecture, and give me a TypeScript specification."

What happened next was both hilarious and depressing.

The AI confidently hallucinated a 300-line Express.js backend with Socket.io, invented fake database schemas, and hallucinated REST endpoints that didn't exist anywhere in the target's actual infrastructure.

The AI wasn't stupid. It was simply blind.

To an LLM running in a terminal, a modern web app is an opaque black box. The browser downloads chunk-split Webpack or Vite bundles, dynamically loads chunks over HTTP/2, configures WebSockets via runtime tokens, and frequently leaves exposed V3 source maps dangling on public CDNs.

If you don't feed your AI agent the actual AST structure, API route signatures, and client-side data contracts, it will do what LLMs always do when starved of ground truth: it will make things up.

So we ran an experiment. We selected 50 high-traffic production web applications across SaaS, developer tools, and e-commerce, and built a dedicated forensic pipeline to see what a coding agent can actually discover from public frontend bundlesβ€”and how to do it clean-room style without stealing a single line of copyrighted code.

Here is what we discovered across those 50 production targets, the surprising telemetry risks lurking in common tools, and why we just open-sourced our engine as CleanRoom-Recon.

1. The Legal Line: Why Clean-Room Engineering Is Not Code Piracy

Before touching a single bundle chunk, we had to establish strict legal guardrails.

There is an enormous difference between stealing someone's software and clean-room reverse engineering:

Clean-Room Engineering vs. Traditional Code Piracy

The Two Worlds:

  1. Code Piracy (The Lawsuit Trap):

    • Scraping and copying minified JavaScript files directly.
    • Ripping proprietary SVG brand logos, trademarked illustrations, and UI copy.
    • Stealing private CSS design tokens or running automated crawling loops that bypass authentication paywalls.
    • The result: DMCA takedowns, copyright infringement claims, and brittle code you don't understand.
  2. Clean-Room Engineering (The Compliant Method):

    • Dissecting client-side bundles strictly to extract public interfaces, functional workflows, and data contracts.
    • Throwing away the original code entirely.
    • Writing 100% fresh, typed TypeScript from first principles based on the reconstructed functional specification.
    • The result: Independent intellectual property, zero copyright exposure, and clean production architecture.

This clean-room methodology is how the computing industry built the IBM PC compatible BIOS in the 1980s, how Wine recreates the Windows API on Linux, and how open-source developers build modern interoperable tools today.

2. The SourceMap Shock: 32% of Production Apps Leak Their Entire TypeScript Codebase

When frontend bundlers (Vite, Next.js, Webpack, esbuild) build your production app, they minify variable names to single letters (function a(b, c){...}).

To help developers debug production crashes in Sentry or Datadog, bundlers create Source Maps (.map files) that map every minified character back to the exact line in your original TypeScript or JSX file.

Many deployment pipelines forget one critical step: deleting or restricting .map files from the public CDN.

Anatomy of a Production SourceMap Exposure

Across the 50 production web apps we audited:

  • 16 out of 50 apps (32%) left full SourceMap V3 files publicly accessible on their CDNs.
  • In 9 of those 16 apps, the source maps contained the complete sourcesContent arrayβ€”meaning every single unminified TypeScript component, custom React hook, database client, and internal comment was sitting directly in the browser's Network tab.

Here is what our AST parser extracts in under 2 seconds when an exposed .map file is encountered:

πŸ“ src/
β”œβ”€β”€ πŸ“ components/
β”‚   β”œβ”€β”€ NavigationBar.tsx
β”‚   β”œβ”€β”€ CanvasEditor.tsx
β”‚   └── BillingModal.tsx
β”œβ”€β”€ πŸ“ services/
β”‚   β”œβ”€β”€ apiClient.ts
β”‚   └── websocketSync.ts
β”œβ”€β”€ πŸ“ hooks/
β”‚   └── useWorkspaceState.ts
└── πŸ“ internal/
    └── paymentGateways.ts 🚨 (Contains unminified merchant IDs and API routes)

If an AI coding agent has access to this recovered file tree, it doesn't need to guess component hierarchy or state managementβ€”it can reconstruct the exact system architecture from ground truth.

3. The Telemetry Trap: What Wireshark Found in "Free" Online Converters

The second major reason we built CleanRoom-Recon was privacy.

When developers need to inspect a token, compare text diffs, or convert an SVG into an icon font, they often search Google and click on random online converter tools.

We hooked up Wireshark and an intercepting proxy to monitor outbound traffic while testing these web utilities:

Network Interception: Surveillance Leaks vs. WebCrypto RAM Isolation

What the network captures revealed:

  • Keystroke Loggers Everywhere: Over 40% of popular online developer tools run third-party session recording SDKs (FullStory, Hotjar, Clarity, LogRocket). As soon as you paste a private JWT, an SSH config, or an API payload into their text area, the entire string is captured as an analytics event and shipped to remote servers.
  • Unencrypted localStorage Storage: Many web formatters save your pasted inputs into localStorage under keys like last_token or session_jwt without encryption, leaving them permanently vulnerable to any rogue browser extension or cross-site script.
  • Server-Side Exfiltration: Some tools that claim to be "online formatters" actually fire background POST requests to remote /api/decode endpoints, transmitting your private code over the wire.

This is why we architected our own free web utilities suite at DevOmniTools.com to execute 100% inside client-side volatile browser RAM using the native W3C Web Cryptography API (window.crypto.subtle)β€”with zero outbound network requests and zero server logging.

4. Engineering CleanRoom-Recon: How the Engine Works

We took the lessons from our 50-app audit and distilled them into an open-source, zero-dependency engine called CleanRoom-Recon.

It is built as both a standalone CLI (npx) and a portable AI skill for Claude Code, Cursor IDE, and Google Antigravity.

Core Modules:

  1. Pre-Flight SSRF Defense (src/ssrf-filter.ts): Before fetching any target URL or discovered script bundle, the engine validates the IP. It strictly blocks loopback addresses (127.0.0.1, localhost), RFC 1918 private subnets (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), and AWS/GCP cloud metadata endpoints (169.254.169.254).
   // Immediate SSRF block if an agent or attacker tries to target internal services
   const check = validateSafeUrl('http://169.254.169.254/latest/meta-data/');
   // Output: { isValid: false, reason: "Forbidden IP: 169.254.0.0/16 link-local..." }
  1. AST & Multi-Protocol Route Extractor (src/api-extractor.ts):

    It doesn't just regex for /api/. It dissects:

    • GraphQL Operations: Automatically extracts query GetUsers and mutation CreateSubscription.
    • Dynamic Template Literals: Converts `/api/v1/workspaces/${id}/billing` into clean route parameters (/api/v1/workspaces/:param/billing).
    • WebSocket Channels: Detects wss:// real-time streaming endpoints.
    • tRPC Procedures: Identifies procedure calls from minified clients.
  2. Storage & Credential Leak Auditor (src/telemetry-auditor.ts):

    Calculates a realistic Privacy Score (0–100):

    • -25 pts (CRITICAL): Detecting sensitive authentication tokens (auth_token, jwt, secret_key) written to unencrypted localStorage.
    • -20 pts: Surveillance session recording SDKs (FullStory, Hotjar).
    • -10 pts: Direct client-side document.cookie mutation.
  3. Automated High-Contrast Mermaid.js Generator (src/architecture-mapper.ts):

    Produces a clean flowchart TD diagram mapping the Client UI Layer $\rightarrow$ API Gateway $\rightarrow$ External Telemetry $\rightarrow$ Recommended WebCrypto RAM Isolation Layer.

5. Running It in 60 Seconds

You can run CleanRoom-Recon against any target application right now without installing anything globally:

npx @devomnitools/cleanroom-recon https://linear.app --out ./recon-output

In under 60 seconds, it writes 5 clean, production-ready artifacts into your output folder:

  • system-architecture.md β€” Complete technical specification with embedded Mermaid flowchart.
  • security-audit.md β€” Privacy score, credential leakage assessment, and tracker breakdown.
  • sourcemap-recovery.md β€” Original project directory tree recovered from production .map chunks.
  • features.csv β€” Clean-room feature parity matrix for rebuilding.
  • architecture.mmd β€” Raw Mermaid diagram ready to drop into GitHub READMEs or RFCs.

Using it as an AI Agent Skill (Claude Code / Cursor):

In Claude Code:

/plugin marketplace add contactumairrana/cleanroom-recon
/plugin install cleanroom-recon@cleanroom-recon

In Cursor IDE:
Simply drop SKILL.md into your .cursor/skills/cleanroom-recon/ directory. Now, whenever you say "dissect this app", your agent invokes the real AST bundle engine instead of hallucinating.

6. The Open-Source Repository

CleanRoom-Recon is 100% open-source under the MIT license:

If you're building with Claude Code, Cursor, or autonomous agents, give it a spin on your favorite web app and check your output folder.

You might be surprised by what's actually hiding in your production bundles!

What's the weirdest or most sensitive thing you've ever found exposed in a production source map or bundle? Let me know in the comments below!

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.