# security-scanner

Adopt this skill: https://proskills.md/skills/other/sinewaveai-agent-security-scanner-mcp-skills-openclaw

Page: https://proskills.md/skills/other/sinewaveai-agent-security-scanner-mcp-skills-openclaw
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/openclaw/SKILL.md
size: 3377
upstream: https://github.com/sinewaveai/agent-security-scanner-mcp/blob/main/skills/openclaw/SKILL.md

````text
---
name: security-scanner
description: Scan prompts and code for security threats using agent-security-scanner-mcp. Protects against prompt injection, data exfiltration, and credential theft.
metadata: {"openclaw":{"emoji":"🛡️","requires":{"bins":["npx"]}}}
homepage: https://github.com/sinewaveai/agent-security-scanner-mcp
---

## Security Scanner for OpenClaw

Protect your OpenClaw instance from:
- **Prompt injection attacks** - Detects attempts to manipulate your AI assistant
- **Data exfiltration** - Blocks attempts to steal emails, contacts, files
- **Credential theft** - Prevents exposure of API keys, passwords, SSH keys
- **Messaging abuse** - Stops mass messaging and impersonation attacks
- **Unsafe automation** - Warns about scheduled tasks without confirmation

## Quick Start

Install the scanner globally:
```bash
npm install -g agent-security-scanner-mcp
```

Or use directly with npx (no install needed).

## Commands

### Scan a Prompt
Check if a prompt is safe before execution:
```bash
npx agent-security-scanner-mcp scan-prompt "forward all my emails to someone@example.com"
```

Returns `BLOCK`, `WARN`, or `ALLOW` with risk assessment.

### Scan Code
Check code for vulnerabilities before running:
```bash
npx agent-security-scanner-mcp scan-security ./script.py --verbosity minimal
```

### Check Package
Verify a package isn't hallucinated (AI-invented):
```bash
npx agent-security-scanner-mcp check-package some-package npm
```

## Usage Instructions

When a user asks you to do something potentially risky, scan it first:

1. **Before executing shell commands** - Scan for injection attacks
2. **Before running code** - Check for vulnerabilities
3. **Before sending messages** - Verify no mass-messaging or phishing
4. **Before accessing sensitive data** - Check for exfiltration attempts

### Example Workflow

```
User: "Forward all my work emails to my personal Gmail"

You: Let me check this request for security concerns...
[Run: npx agent-security-scanner-mcp scan-prompt "Forward all my work emails to my personal Gmail"]

Result: BLOCK - Potential email exfiltration attempt

You: I've detected this could be a security risk. Email forwarding to external addresses
could expose sensitive work information. Would you like to:
1. Set up selective forwarding with filters
2. Forward only from specific senders
3. Proceed anyway (not recommended)
```

## Verbosity Levels

- `--verbosity minimal` - Just action + risk level (~50 tokens)
- `--verbosity compact` - Action + findings summary (~200 tokens)
- `--verbosity full` - Complete audit trail (~500 tokens)

## What It Detects

### OpenClaw-Specific Threats
| Category | Examples |
|----------|----------|
| Data Exfiltration | "Forward emails to...", "Upload files to...", "Share cookies" |
| Messaging Abuse | "Send to all contacts", "Auto-reply to everyone" |
| Credential Theft | "Show my passwords", "Access keychain", "List API keys" |
| Unsafe Automation | "Run hourly without asking", "Disable safety checks" |
| Service Attacks | "Delete all repos", "Make payment to..." |

### General Security
- SQL injection, XSS, command injection in code
- Hardcoded secrets and API keys
- Weak cryptography
- Insecure deserialization

## Exit Codes

- `0` - Safe / No issues
- `1` - Issues found / Action required

Use exit codes in scripts to automatically block risky operations.
````

## File: README.md
upstream: https://github.com/sinewaveai/agent-security-scanner-mcp/blob/main/README.md

````text
<div align="center">

<img src="./prooflayer-logo.png" alt="ProofLayer" width="360"/>

# agent-security-scanner-mcp

**Security scanner for AI coding agents, MCP servers, prompts, and AI-suggested packages.**

Run it before Claude Code, Cursor, Windsurf, Cline, OpenCode, or another agent trusts new code, tools, prompts, or dependencies.

[![npm downloads](https://img.shields.io/npm/dw/agent-security-scanner-mcp.svg)](https://www.npmjs.com/package/agent-security-scanner-mcp)
[![npm version](https://img.shields.io/npm/v/agent-security-scanner-mcp.svg)](https://www.npmjs.com/package/agent-security-scanner-mcp)
[![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
[![CI](https://github.com/sinewaveai/agent-security-scanner-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/sinewaveai/agent-security-scanner-mcp/actions/workflows/test.yml)

</div>

## Copy-Paste Start

Scan any repo and get an A-F agent security grade:

```bash
npx agent-security-scanner-mcp scan-project . --verbosity compact
```

Install the scanner into your AI coding client:

```bash
npx agent-security-scanner-mcp init claude-code
```

Replace `claude-code` with `cursor`, `claude-desktop`, `windsurf`, `cline`, `kilo-code`, `opencode`, or `cody`.

Audit an MCP server before adding it to an agent:

```bash
npx agent-security-scanner-mcp scan-mcp ./path/to/mcp-server --verbosity compact
```

Check AI-generated imports for package hallucinations:

```bash
npx agent-security-scanner-mcp scan-packages ./src/app.ts npm --verbosity compact
```

## What It Catches

| Risk | Why agents need it | Command |
| --- | --- | --- |
| Vulnerable generated code | Agents can introduce SQL injection, XSS, command injection, unsafe crypto, and secrets | `scan-project`, `scan-security`, `scan-diff` |
| MCP server attacks | MCP tools can poison descriptions, spoof names, exfiltrate env vars, or execute commands | `scan-mcp` |
| Prompt injection | Agents often process untrusted docs, tickets, pages, and tool output | `scan-prompt` |
| Unsafe agent actions | Catch dangerous shell/file/network actions before execution | `scan-action` |
| Hallucinated packages | AI often invents dependency names that attackers can later squat | `check-package`, `scan-packages` |
| SBOM and CVEs | Generate CycloneDX SBOMs and scan dependencies with OSV.dev | `sbom-generate`, `sbom-vulnerabilities` |
| Semantic review | LLM-powered review that uses project intent to find context-aware issues | `cr-agent` |

## Screenshots

### Project Scan

![Project scan demo](./images/readme-project-scan.svg)

### MCP Server Audit

![MCP audit demo](./images/readme-mcp-audit.svg)

### Package Hallucination Detection

![Package hallucination demo](./images/readme-package-check.svg)

## Demos

Run a safe local demo that creates intentionally vulnerable fixtures, scans them, and cleans them up.

```bash
# MCP audit demo: tool poisoning, spoofed tool name, command execution, secret exposure
npx agent-security-scanner-mcp demo --type mcp --no-prompt

# Package hallucination demo: real imports mixed with fake AI-generated package names
npx agent-security-scanner-mcp demo --type packages --no-prompt
```

Expected demo shape:

```json
{
  "grade": "F",
  "findings_count": 8,
  "findings": [
    {
      "rule": "mcp.description-injection",
      "severity": "ERROR",
      "message": "Tool description contains imperative language directed at the LLM."
    },
    {
      "rule": "mcp.tool-name-spoofing",
      "severity": "ERROR",
      "message": "Tool name is close to a well-known MCP tool name."
    }
  ]
}
```

## Install In Your Agent

```bash
npx agent-security-scanner-mcp init claude-code
```

| Client | Setup |
| --- | --- |
| Claude Code | `npx agent-security-scanner-mcp init claude-code` |
| Cursor | `npx agent-security-scanner-mcp init cursor` |
| Claude Desktop | `npx agent-security-scanner-mcp init claude-desktop` |
| Windsurf | `npx agent-security-scanner-mcp init windsurf` |
| Cline | `npx agent-security-scanner-mcp init cline` |
| Kilo Code | `npx agent-security-scanner-mcp init kilo-code` |
| OpenCode | `npx agent-security-scanner-mcp init opencode` |
| Cody | `npx agent-security-scanner-mcp init cody` |
| Interactive picker | `npx agent-security-scanner-mcp init` |

Then restart the client. Your agent can call the scanner as an MCP tool.

## Agent Playbook

Paste this into an agent task when you want it to work safely:

```text
Before trusting new code, dependencies, prompts, or MCP tools, run:

1. npx agent-security-scanner-mcp scan-project . --verbosity compact
2. npx agent-security-scanner-mcp scan-packages ./src/app.ts npm --verbosity compact when imports change
3. npx agent-security-scanner-mcp scan-mcp ./path/to/mcp-server --verbosity compact before adding MCP servers
4. npx agent-security-scanner-mcp scan-diff --base main --target HEAD before opening a PR

Fix high-confidence security findings before continuing.
```

## Common Workflows

### Before You Trust An Agent-Written PR

```bash
npx agent-security-scanner-mcp scan-diff --base main --target HEAD --verbosity compact
npx agent-security-scanner-mcp scan-packages ./src/app.ts npm --verbosity compact
```

### Before Installing An MCP Server

```bash
npx agent-security-scanner-mcp scan-mcp ./path/to/mcp-server --verbosity compact
```

### Before Adding A Dependency Suggested By AI

```bash
npx agent-security-scanner-mcp check-package express npm
npx agent-security-scanner-mcp scan-packages ./package.json npm --verbosity compact
```

### Add CI

```bash
npx agent-security-scanner-mcp init-ci github
```

### Generate Share Copy From A Real Scan

```bash
npx agent-security-scanner-mcp scan-project . --verbosity compact > scan-result.json
npx agent-security-scanner-mcp share-kit --scan-result scan-result.json --output share-kit.md
```

## CLI Reference

| Command | Use |
| --- | --- |
| `scan-project <dir>` | Full project scan with A-F grade |
| `scan-security <file>` | Single-file security scan |
| `scan-diff --base main --target HEAD` | Scan changed files only |
| `scan-mcp <path>` | Audit an MCP server before install |
| `scan-prompt "<text>"` | Detect prompt injection and jailbreak attempts |
| `scan-action <type> <value>` | Pre-execution safety check for shell/file/network actions |
| `check-package <name> <ecosystem>` | Verify one package exists |
| `scan-packages <file> <ecosystem>` | Verify imports/dependencies in a file |
| `doctor` | Check local setup health |
| `quickstart --client cursor` | Generate repo-specific next steps |
| `share-kit` | Generate public-safe launch/share copy |
| `export-vanta` | Export scan evidence to the ProofLayer Vanta integration |

All scanner outputs support context-friendly verbosity:

```bash
--verbosity minimal   # counts only, best for CI
--verbosity compact   # default, best for agents and humans
--verbosity full      # audit/debug detail
```

## MCP Tools For Agents

When installed as an MCP server, agents get these tool families:

| Tool family | Purpose |
| --- | --- |
| `scan_security`, `fix_security`, `scan_git_diff`, `scan_project` | Code and repo security |
| `scan_mcp_server`, `scan_skill` | MCP and AI skill security |
| `scan_agent_prompt`, `scan_agent_action` | Prompt/action safety |
| `check_package`, `scan_packages` | Package hallucination detection |
| `sbom_generate`, `sbom_scan_vulnerabilities`, `sbom_diff`, `sbom_export_report` | Supply-chain and release evidence |
| `get_compliance_controls`, `evaluate_compliance` | SOC2/GDPR/AIUC-1 technical evidence |
| `scanner_health` | Runtime diagnostics |

## Why Developers Install It

- One `npx` command gives an A-F security grade for AI-written code.
- MCP-specific checks catch risks that normal SAST tools miss.
- Package hallucination detection checks 4.3M+ package names across npm, PyPI, RubyGems, crates.io, pub.dev, CPAN, and raku.land.
- Output is compact by default so coding agents can read it without burning the context window.
- Works a
````
