Security scanner for VS Code extensions. Detect malicious behaviors, generate trust scores, and enforce security policies.
Protect your IDE from malicious extensions. Extension Guard scans your installed VSCode extensions offline, detecting data exfiltration, remote code execution, credential theft, and more.
- Offline scanning - All analysis runs locally, no data uploaded
- Multi-IDE support - VS Code, VS Code Insiders, Cursor, Windsurf, Trae, VSCodium
- 7 detection rules - Data exfiltration, RCE, credential theft, obfuscation, and more
- Trust scoring - 0-100 score based on findings severity
- Multiple output formats - Table, JSON, SARIF (GitHub Code Scanning), Markdown
- Policy engine - Enforce security policies in CI/CD with exit codes
- MITRE ATT&CK mapping - Findings mapped to attack techniques
npm install -g extension-guard# Scan all installed extensions
extension-guard scan
# Scan specific IDE
extension-guard scan --ide cursor
# Output as JSON
extension-guard scan --format json -o report.json
# Output as SARIF for GitHub Code Scanning
extension-guard scan --format sarif -o report.sarif| Rule ID | Severity | Description |
|---|---|---|
| EG-CRIT-001 | Critical | Data exfiltration (system info collection + HTTP to IP) |
| EG-CRIT-002 | Critical | Remote code execution (eval, exec, spawn) |
| EG-CRIT-003 | Critical | Credential access (.ssh, .aws, .env files) |
| EG-HIGH-001 | High | Obfuscated code (base64, hex encoding, high entropy) |
| EG-HIGH-002 | High | Suspicious network (HTTP to IP, dynamic URLs) |
| EG-HIGH-006 | High | Hardcoded secrets (API keys, tokens, passwords) |
| EG-MED-001 | Medium | Excessive activation (activationEvents: ["*"]) |
Create .extension-guard.json in your project:
{
"version": "1.0",
"policy": {
"blocklist": ["malicious.extension"],
"rules": {
"minTrustScore": { "threshold": 70, "action": "block" },
"blockObfuscated": { "enabled": true, "action": "warn" },
"requireVerifiedPublisher": { "enabled": true, "action": "info" }
}
}
}Run audit in CI:
# Fail if any blocking violations
extension-guard audit --config .extension-guard.json
# Fail on warnings too
extension-guard audit --fail-on warnExit codes:
0- No violations at or above fail-on level1- Violations found (critical/high issues forscan, policy violations foraudit)2- Configuration error (policy file not found or invalid)3- Execution error (path not found, permission denied, etc.)
Human-readable terminal output with colors and formatting.
extension-guard scan --format json -o report.jsonFor GitHub Code Scanning integration:
extension-guard scan --format sarif -o results.sarifextension-guard scan --format markdown -o report.md# Scan commands
extension-guard scan [options]
-i, --ide <ide> Target IDE (vscode, vscode-insiders, cursor, windsurf, trae, vscodium)
-p, --path <paths...> Custom extension paths
-f, --format <format> Output format (table, json, sarif, markdown)
-o, --output <file> Output file path
--include-safe Include extensions with no findings
-q, --quiet Suppress progress output
# Audit command (CI/CD)
extension-guard audit [options]
-c, --config <path> Policy config file (default: .extension-guard.json)
--fail-on <level> Fail on: block, warn, info (default: block)
-f, --format <format> Output format
-o, --output <file> Output file path
# Other
extension-guard --version
extension-guard --helpExtension Guard uses a multi-layer approach to reduce false positives:
-
Extension Categorization - Automatically detects extension type (AI assistant, language support, theme, linter, etc.) from manifest
-
Category-Aware Analysis - Expected behaviors for each category are downgraded. For example:
- AI assistants (Copilot, Codeium) legitimately use network/process spawning
- Language support (ms-python, rust-analyzer) legitimately spawn interpreters
- Developer tools (Code Runner, REST Client) legitimately spawn processes and make network requests
- Remote development (Remote-SSH, Dev Containers) legitimately use SSH and network
- Grammar extensions may have high-entropy bundled code
-
Trusted Publisher Recognition - Well-known publishers (Microsoft, GitHub, etc.) get reduced severity findings. This is "soft trust" — findings are downgraded, not bypassed, because supply chain attacks can hit anyone.
-
Configurable Policy - Allowlist/blocklist for organizational control in CI/CD
| Category | Examples | Expected Behaviors |
|---|---|---|
| ai-assistant | Copilot, Codeium, Kilo Code | Network, process spawn, env access |
| language-support | ms-python, rust-analyzer, Go | Process spawn, dynamic require |
| developer-tools | Code Runner, REST Client, Live Server | Process spawn, network requests |
| remote-development | Remote-SSH, Dev Containers, WSL | SSH, network, process spawn |
| testing | Jest Runner, Test Explorer | Process spawn |
| notebook | Jupyter | Kernel spawn, network |
| debugger | Node Debug, Python Debug | Process spawn |
| linter | ESLint, Prettier | Process spawn |
| scm | GitLens, Git Graph | Git credentials access |
| language | Adblock grammar, syntax themes | High-entropy bundled code |
| theme | Color themes, icon themes | Minimal runtime |
Each extension receives a trust score from 0-100:
| Score | Risk Level |
|---|---|
| 80-100 | Low risk |
| 60-79 | Medium risk |
| 40-59 | High risk |
| 0-39 | Critical risk |
Penalties:
- Critical finding: -35 points
- High finding: -18 points
- Medium finding: -8 points
- Low finding: -3 points
- Info finding: -1 point
import { ExtensionGuardScanner, JsonReporter, SarifReporter } from '@aspect-guard/core';
const scanner = new ExtensionGuardScanner();
const report = await scanner.scan({ ide: 'vscode' });
// Generate JSON report
const jsonReporter = new JsonReporter();
console.log(jsonReporter.generate(report));
// Generate SARIF report
const sarifReporter = new SarifReporter();
console.log(sarifReporter.generate(report));Contributions are welcome! Please read our Contributing Guide for details.
If you discover a security vulnerability, please open an issue or contact us directly.
MIT - see LICENSE for details.