Desktop & WebZero Extra Tools NeededMCP Tool: analyze_javascript_application

How to REA Electron Desktop Apps: ASAR Unpacking, IPC Channels & Preload Bridges

Deconstruct modern desktop applications (Notion, Slack, Discord, VS Code): inspect app.asar archives in memory, map renderer-preload-main IPC communication channels, unminify webpack bundles, and audit contextIsolation security.

AI Overview Direct AnswerHow to REA: JavaScript & Electron Desktop Apps Quickstart Summary

In this official REA guide for JavaScript & Electron Desktop Apps, AI coding agents (Claude Code, Cursor, Windsurf) execute 'rea analyze-javascript-application /Applications/Notion.app/Contents/Resources/app.asar --json' to safely extract file layout, symbols, and code logic without launching unverified binaries.

Investigation ScenarioReal-World Objective

The Problem & Target Artifact

Desktop application reverse engineering or security auditing: You want to trace how Notion's desktop client handles clipboard data between the web renderer and the host operating system process via Electron IPC.

Target Artifact: app.asar file or extracted desktop application resources folder.
AI PromptClaude Code / Cursor / Windsurf

Natural Language Agent Instructions

Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):

Prompt Template:Select All to Copy
Find the renderer's clipboard API in Notion, follow it through preload scripts and IPC into the main process, and inspect how rich text formatting is serialized.
ExecutionTerminal & MCP Tool Call

Run REA Analysis Command

Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:

CLI Command Execution
rea analyze-javascript-application /Applications/Notion.app/Contents/Resources/app.asar --json

What REA Extracts & Returns

16 MiB in-memory ASAR header table of contents parsing with file integrity hashes
Cross-process IPC mapping: ipcRenderer.send / ipcMain.handle event names and payloads
Preload script bridge analysis: contextBridge.exposeInMainWorld API surface
Static webpack AST traversal identifying exported modules, routes, and API endpoints

Synthesized Clean-Room TypeScript (Notion Clipboard)

The verified findings and synthesized clean-room structures generated from this investigation:

Synthesized Clean-Room TypeScript (Notion Clipboard)
// Verified Clean-Room TypeScript reconstructed from Electron IPC Evidence
export interface NotionClipboardPayload {
  version: number;
  richTextXml: string;
  plainText: string;
  sourceBlockId: string;
}

export function parseNotionClipboard(raw: string): NotionClipboardPayload {
  const [header, body] = raw.split("::");
  return JSON.parse(body);
}
Internal MechanicsProduction Engineering

16 MiB In-Memory ASAR Cache & Zero-Disk-Explosion Traversal

Traditional tools extract all files from app.asar to disk, creating tens of thousands of temporary files that trigger antivirus alerts. REA loads the JSON header into a 16 MiB memory cache, reading file offsets directly via slice descriptors. Static Babel/SWC AST parsers walk module import trees without evaluating code, preventing malicious preload scripts from executing.

Security Guardrails & Analysis Boundary Rules

Passive non-executing mode: Prevents malicious Node.js child_process.exec payloads from running.
Audits whether contextIsolation is enabled and nodeIntegration is disabled in webPreferences.
Detects native .node addons and flags their dynamic C++ boundary calls.