Skip to content

a5c-ai/babysitter / library/specializations/desktop-development/skills/electron-ipc-security-audit

electron-ipc-security-audit

Verified

Analyze Electron IPC implementations for security vulnerabilities including contextIsolation, nodeIntegration, preload scripts, and channel validation

FileKindSize
README.mdmarkdown2.6 KB
SKILL.mdskill md6.9 KB
# electron-ipc-security-audit

Analyze Electron IPC implementations for security vulnerabilities.

## Overview

This skill performs comprehensive security audits of Electron applications, focusing on inter-process communication patterns. It identifies vulnerabilities related to contextIsolation, nodeIntegration, preload scripts, and IPC channel security.

## Quick Start

```javascript
const result = await invokeSkill('electron-ipc-security-audit', {
  projectPath: '/path/to/electron-app',
  auditScope: ['all'],
  severity: 'all',
  includeRecommendations: true
});
```

## Features

### Security Checks

| Category | Checks Performed |
|----------|------------------|
| Context Isolation | contextIsolation, nodeIntegration, sandbox settings |
| IPC Security | Channel validation, input sanitization, whitelist enforcement |
| Preload Scripts | contextBridge usage, exposed APIs, prototype pollution |
| CSP | Content Security Policy headers, script-src directives |
| Code Execution | eval, Function, dynamic code risks |

### Severity Levels

- **Critical**: Immediate exploitation risk (nodeIntegration enabled, direct ipcRenderer exposure)
- **High**: Significant security weakness (missing input validation, webSecurity disabled)
- **Medium**: Best practice violation (overly permissive access, missing CSP)
- **Low**: Minor improvements recommended

## Output

```json
{
  "success": true,
  "summary": {
    "totalIssues": 5,
    "critical": 1,
    "high": 2,
    "medium": 2,
    "low": 0
  },
  "findings": [
    {
      "id": "IPC-001",
      "severity": "critical",
      "category": "IPC Security",
      "title": "Direct ipcRenderer exposure",
      "description": "ipcRenderer is exposed directly through contextBridge",
      "file": "src/preload.js",
      "line": 15,
      "recommendation": "Expose only whitelisted channels through contextBridge"
    }
  ],
  "securityScore": 45
}
```

## Common Findings

### Critical Issues

1. **nodeIntegration: true** - Allows renderer to access Node.js APIs
2. **contextIsolation: false** - Enables prototype pollution attacks
3. **Direct ipcRenderer exposure** - Allows arbitrary IPC communication

### Remediation Examples

```javascript
// Before (Vulnerable)
new BrowserWindow({
  webPreferences: {
    nodeIntegration: true,
    contextIsolation: false
  }
});

// After (Secure)
new BrowserWindow({
  webPreferences: {
    nodeIntegration: false,
    contextIsolation: true,
    sandbox: true,
    preload: path.join(__dirname, 'preload.js')
  }
});
```

## Related Skills

- `electron-main-preload-generator`
- `electron-builder-config`

## Related Agents

- `electron-architect`
- `desktop-security-auditor`
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall