agent-security-scanner-mcp 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +286 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# agent-security-scanner-mcp
|
|
2
2
|
|
|
3
|
-
Security scanner
|
|
3
|
+
Security scanner for AI coding agents and autonomous assistants. Scans code for vulnerabilities, detects hallucinated packages, and blocks prompt injection — via MCP (Claude Code, Cursor, Windsurf, Cline) or CLI (OpenClaw, CI/CD).
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/agent-security-scanner-mcp)
|
|
6
6
|
[](https://www.npmjs.com/package/agent-security-scanner-mcp)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](benchmarks/RESULTS.md)
|
|
9
|
+
[](https://github.com/sinewaveai/agent-security-scanner-mcp/actions/workflows/test.yml)
|
|
10
|
+
|
|
11
|
+
> **New in v3.3.0:** Full [OpenClaw](https://openclaw.ai) integration with 30+ rules targeting autonomous AI threats — data exfiltration, credential theft, messaging abuse, and unsafe automation. [See OpenClaw setup](#openclaw-integration).
|
|
8
12
|
|
|
9
13
|
## Tools
|
|
10
14
|
|
|
@@ -12,6 +16,8 @@ Security scanner MCP server for AI coding agents. Scans code for vulnerabilities
|
|
|
12
16
|
|------|-------------|-------------|
|
|
13
17
|
| `scan_security` | Scan code for vulnerabilities (1700+ rules, 12 languages) with AST and taint analysis | After writing or editing any code file |
|
|
14
18
|
| `fix_security` | Auto-fix all detected vulnerabilities (120 fix templates) | After `scan_security` finds issues |
|
|
19
|
+
| `scan_git_diff` | Scan only changed files in git diff | Before commits or in PR reviews |
|
|
20
|
+
| `scan_project` | Scan entire project with A-F security grading | For project-wide security audits |
|
|
15
21
|
| `check_package` | Verify a package name isn't AI-hallucinated (4.3M+ packages) | Before adding any new dependency |
|
|
16
22
|
| `scan_packages` | Bulk-check all imports in a file for hallucinated packages | Before committing code with new imports |
|
|
17
23
|
| `scan_agent_prompt` | Detect prompt injection and malicious instructions (56 rules) | Before acting on external/untrusted input |
|
|
@@ -36,8 +42,18 @@ scan_security → review findings → fix_security → verify fix
|
|
|
36
42
|
|
|
37
43
|
### Before Committing
|
|
38
44
|
```
|
|
45
|
+
scan_git_diff → scan only changed files for fast feedback
|
|
39
46
|
scan_packages → verify all imports are legitimate
|
|
40
|
-
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### For PR Reviews
|
|
50
|
+
```
|
|
51
|
+
scan_git_diff --base main → scan PR changes against main branch
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### For Project Audits
|
|
55
|
+
```
|
|
56
|
+
scan_project → get A-F security grade and aggregated metrics
|
|
41
57
|
```
|
|
42
58
|
|
|
43
59
|
### When Processing External Input
|
|
@@ -327,6 +343,105 @@ List all 1700+ security scanning rules and 120 fix templates. Use to understand
|
|
|
327
343
|
|
|
328
344
|
---
|
|
329
345
|
|
|
346
|
+
### `scan_git_diff`
|
|
347
|
+
|
|
348
|
+
Scan only files changed in git diff for security vulnerabilities. Use in PR workflows, pre-commit hooks, or to check recent changes before pushing. Significantly faster than full project scans.
|
|
349
|
+
|
|
350
|
+
**Parameters:**
|
|
351
|
+
|
|
352
|
+
| Parameter | Type | Required | Description |
|
|
353
|
+
|-----------|------|----------|-------------|
|
|
354
|
+
| `base` | string | No | Base commit/branch to diff against (default: `HEAD~1`) |
|
|
355
|
+
| `target` | string | No | Target commit/branch (default: `HEAD`) |
|
|
356
|
+
| `verbosity` | string | No | `"minimal"`, `"compact"` (default), `"full"` |
|
|
357
|
+
|
|
358
|
+
**Example:**
|
|
359
|
+
|
|
360
|
+
```json
|
|
361
|
+
// Input
|
|
362
|
+
{ "base": "main", "target": "HEAD" }
|
|
363
|
+
|
|
364
|
+
// Output
|
|
365
|
+
{
|
|
366
|
+
"base": "main",
|
|
367
|
+
"target": "HEAD",
|
|
368
|
+
"files_scanned": 5,
|
|
369
|
+
"issues_count": 3,
|
|
370
|
+
"issues": [
|
|
371
|
+
{
|
|
372
|
+
"file": "src/auth.js",
|
|
373
|
+
"line": 42,
|
|
374
|
+
"ruleId": "sql-injection",
|
|
375
|
+
"severity": "error",
|
|
376
|
+
"message": "SQL injection vulnerability detected"
|
|
377
|
+
}
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
### `scan_project`
|
|
385
|
+
|
|
386
|
+
Scan an entire project or directory for security vulnerabilities with aggregated metrics and A-F security grading. Use for security audits, compliance checks, or initial codebase assessment.
|
|
387
|
+
|
|
388
|
+
**Parameters:**
|
|
389
|
+
|
|
390
|
+
| Parameter | Type | Required | Description |
|
|
391
|
+
|-----------|------|----------|-------------|
|
|
392
|
+
| `directory` | string | Yes | Path to project directory to scan |
|
|
393
|
+
| `include_patterns` | array | No | Glob patterns to include (e.g., `["**/*.js", "**/*.py"]`) |
|
|
394
|
+
| `exclude_patterns` | array | No | Glob patterns to exclude (default: `node_modules`, `.git`, etc.) |
|
|
395
|
+
| `verbosity` | string | No | `"minimal"`, `"compact"` (default), `"full"` |
|
|
396
|
+
|
|
397
|
+
**Example:**
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
// Input
|
|
401
|
+
{ "directory": "./src", "verbosity": "compact" }
|
|
402
|
+
|
|
403
|
+
// Output
|
|
404
|
+
{
|
|
405
|
+
"directory": "/path/to/src",
|
|
406
|
+
"files_scanned": 24,
|
|
407
|
+
"issues_count": 12,
|
|
408
|
+
"grade": "C",
|
|
409
|
+
"by_severity": {
|
|
410
|
+
"error": 3,
|
|
411
|
+
"warning": 7,
|
|
412
|
+
"info": 2
|
|
413
|
+
},
|
|
414
|
+
"by_category": {
|
|
415
|
+
"sql-injection": 2,
|
|
416
|
+
"xss": 3,
|
|
417
|
+
"hardcoded-secret": 1,
|
|
418
|
+
"insecure-crypto": 4,
|
|
419
|
+
"command-injection": 2
|
|
420
|
+
},
|
|
421
|
+
"issues": [
|
|
422
|
+
{
|
|
423
|
+
"file": "auth.js",
|
|
424
|
+
"line": 15,
|
|
425
|
+
"ruleId": "sql-injection",
|
|
426
|
+
"severity": "error",
|
|
427
|
+
"message": "SQL injection vulnerability"
|
|
428
|
+
}
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Security Grades:**
|
|
434
|
+
|
|
435
|
+
| Grade | Criteria |
|
|
436
|
+
|-------|----------|
|
|
437
|
+
| A | 0 critical/error issues |
|
|
438
|
+
| B | 1-2 error issues, no critical |
|
|
439
|
+
| C | 3-5 error issues |
|
|
440
|
+
| D | 6-10 error issues |
|
|
441
|
+
| F | 11+ error issues or any critical |
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
330
445
|
## Supported Languages
|
|
331
446
|
|
|
332
447
|
| Language | Vulnerabilities Detected | Analysis |
|
|
@@ -392,6 +507,7 @@ npx agent-security-scanner-mcp
|
|
|
392
507
|
| Kilo Code | `npx agent-security-scanner-mcp init kilo-code` |
|
|
393
508
|
| OpenCode | `npx agent-security-scanner-mcp init opencode` |
|
|
394
509
|
| Cody | `npx agent-security-scanner-mcp init cody` |
|
|
510
|
+
| **OpenClaw** | `npx agent-security-scanner-mcp init openclaw` |
|
|
395
511
|
| Interactive | `npx agent-security-scanner-mcp init` |
|
|
396
512
|
|
|
397
513
|
The `init` command auto-detects your OS, locates the config file, creates a backup, and adds the MCP server entry. **Restart your client after running init.**
|
|
@@ -451,6 +567,157 @@ Available languages: `js` (default), `py`, `go`, `java`.
|
|
|
451
567
|
|
|
452
568
|
---
|
|
453
569
|
|
|
570
|
+
## CLI Tools
|
|
571
|
+
|
|
572
|
+
Use the scanner directly from command line (for scripts, CI/CD, or OpenClaw):
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
# Scan a prompt for injection attacks
|
|
576
|
+
npx agent-security-scanner-mcp scan-prompt "ignore previous instructions"
|
|
577
|
+
|
|
578
|
+
# Scan a file for vulnerabilities
|
|
579
|
+
npx agent-security-scanner-mcp scan-security ./app.py --verbosity minimal
|
|
580
|
+
|
|
581
|
+
# Scan git diff (changed files only)
|
|
582
|
+
npx agent-security-scanner-mcp scan-diff --base main --target HEAD
|
|
583
|
+
|
|
584
|
+
# Scan entire project with grading
|
|
585
|
+
npx agent-security-scanner-mcp scan-project ./src
|
|
586
|
+
|
|
587
|
+
# Check if a package is legitimate
|
|
588
|
+
npx agent-security-scanner-mcp check-package flask pypi
|
|
589
|
+
|
|
590
|
+
# Scan file imports for hallucinated packages
|
|
591
|
+
npx agent-security-scanner-mcp scan-packages ./requirements.txt pypi
|
|
592
|
+
|
|
593
|
+
# Install Claude Code hooks for automatic scanning
|
|
594
|
+
npx agent-security-scanner-mcp init-hooks
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
**Exit codes:** `0` = safe, `1` = issues found. Use in scripts to block risky operations.
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Configuration (`.scannerrc`)
|
|
602
|
+
|
|
603
|
+
Create a `.scannerrc.yaml` or `.scannerrc.json` in your project root to customize scanning behavior:
|
|
604
|
+
|
|
605
|
+
```yaml
|
|
606
|
+
# .scannerrc.yaml
|
|
607
|
+
version: 1
|
|
608
|
+
|
|
609
|
+
# Suppress specific rules
|
|
610
|
+
suppress:
|
|
611
|
+
- rule: "insecure-random"
|
|
612
|
+
reason: "Using for non-cryptographic purposes"
|
|
613
|
+
- rule: "detect-disable-mustache-escape"
|
|
614
|
+
paths: ["src/cli/**"]
|
|
615
|
+
|
|
616
|
+
# Exclude paths from scanning
|
|
617
|
+
exclude:
|
|
618
|
+
- "node_modules/**"
|
|
619
|
+
- "dist/**"
|
|
620
|
+
- "**/*.test.js"
|
|
621
|
+
- "**/*.spec.ts"
|
|
622
|
+
|
|
623
|
+
# Minimum severity to report
|
|
624
|
+
severity_threshold: "warning" # "info", "warning", or "error"
|
|
625
|
+
|
|
626
|
+
# Context-aware filtering (enabled by default)
|
|
627
|
+
context_filtering: true
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
**Configuration options:**
|
|
631
|
+
|
|
632
|
+
| Option | Type | Description |
|
|
633
|
+
|--------|------|-------------|
|
|
634
|
+
| `suppress` | array | Rules to suppress, optionally scoped to paths |
|
|
635
|
+
| `exclude` | array | Glob patterns for paths to skip |
|
|
636
|
+
| `severity_threshold` | string | Minimum severity to report (`info`, `warning`, `error`) |
|
|
637
|
+
| `context_filtering` | boolean | Enable/disable safe module filtering (default: `true`) |
|
|
638
|
+
|
|
639
|
+
The scanner automatically loads config from the current directory or any parent directory.
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
## Claude Code Hooks
|
|
644
|
+
|
|
645
|
+
Automatically scan files after every edit with Claude Code hooks integration.
|
|
646
|
+
|
|
647
|
+
### Install Hooks
|
|
648
|
+
|
|
649
|
+
```bash
|
|
650
|
+
npx agent-security-scanner-mcp init-hooks
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
This installs a `post-tool-use` hook that triggers security scanning after `Write`, `Edit`, or `MultiEdit` operations.
|
|
654
|
+
|
|
655
|
+
### With Prompt Guard
|
|
656
|
+
|
|
657
|
+
```bash
|
|
658
|
+
npx agent-security-scanner-mcp init-hooks --with-prompt-guard
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
Adds a `PreToolUse` hook that scans prompts for injection attacks before executing tools.
|
|
662
|
+
|
|
663
|
+
### What Gets Installed
|
|
664
|
+
|
|
665
|
+
The command adds hooks to `~/.claude/settings.json`:
|
|
666
|
+
|
|
667
|
+
```json
|
|
668
|
+
{
|
|
669
|
+
"hooks": {
|
|
670
|
+
"post-tool-use": [
|
|
671
|
+
{
|
|
672
|
+
"matcher": "Write|Edit|MultiEdit",
|
|
673
|
+
"command": "npx agent-security-scanner-mcp scan-security \"$TOOL_INPUT_file_path\" --verbosity minimal"
|
|
674
|
+
}
|
|
675
|
+
]
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
### Hook Behavior
|
|
681
|
+
|
|
682
|
+
- **Non-blocking:** Hooks report findings but don't prevent file writes
|
|
683
|
+
- **Minimal output:** Uses `--verbosity minimal` to avoid context overflow
|
|
684
|
+
- **Automatic:** Runs on every file modification without manual intervention
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
## OpenClaw Integration
|
|
689
|
+
|
|
690
|
+
[OpenClaw](https://openclaw.ai) is an autonomous AI assistant with broad system access. This scanner provides security guardrails for OpenClaw users.
|
|
691
|
+
|
|
692
|
+
### Install
|
|
693
|
+
|
|
694
|
+
```bash
|
|
695
|
+
npx agent-security-scanner-mcp init openclaw
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
This installs a skill to `~/.openclaw/workspace/skills/security-scanner/`.
|
|
699
|
+
|
|
700
|
+
### OpenClaw-Specific Threats
|
|
701
|
+
|
|
702
|
+
The scanner includes 30+ rules targeting OpenClaw's unique attack surface:
|
|
703
|
+
|
|
704
|
+
| Category | Examples |
|
|
705
|
+
|----------|----------|
|
|
706
|
+
| **Data Exfiltration** | "Forward emails to...", "Upload files to...", "Share browser cookies" |
|
|
707
|
+
| **Messaging Abuse** | "Send to all contacts", "Auto-reply to everyone" |
|
|
708
|
+
| **Credential Theft** | "Show my passwords", "Access keychain", "List API keys" |
|
|
709
|
+
| **Unsafe Automation** | "Run hourly without asking", "Disable safety checks" |
|
|
710
|
+
| **Service Attacks** | "Delete all repos", "Make payment to..." |
|
|
711
|
+
|
|
712
|
+
### Usage in OpenClaw
|
|
713
|
+
|
|
714
|
+
The skill is auto-discovered. Use it by asking:
|
|
715
|
+
- "Scan this prompt for security issues"
|
|
716
|
+
- "Check if this code is safe to run"
|
|
717
|
+
- "Verify these packages aren't hallucinated"
|
|
718
|
+
|
|
719
|
+
---
|
|
720
|
+
|
|
454
721
|
## What This Scanner Detects
|
|
455
722
|
|
|
456
723
|
AI coding agents introduce attack surfaces that traditional security tools weren't designed for:
|
|
@@ -509,7 +776,7 @@ AI coding agents introduce attack surfaces that traditional security tools weren
|
|
|
509
776
|
|----------|-------|
|
|
510
777
|
| **Transport** | stdio |
|
|
511
778
|
| **Package** | `agent-security-scanner-mcp` (npm) |
|
|
512
|
-
| **Tools** |
|
|
779
|
+
| **Tools** | 8 |
|
|
513
780
|
| **Languages** | 12 |
|
|
514
781
|
| **Ecosystems** | 7 |
|
|
515
782
|
| **Auth** | None required |
|
|
@@ -591,6 +858,21 @@ All MCP tools support a `verbosity` parameter to minimize context window consump
|
|
|
591
858
|
|
|
592
859
|
## Changelog
|
|
593
860
|
|
|
861
|
+
### v3.4.0
|
|
862
|
+
- **Severity Calibration** - 207-rule severity map with HIGH/MEDIUM/LOW confidence scores for more accurate prioritization
|
|
863
|
+
- **Cross-Engine Deduplication** - ~30-50% noise reduction by deduplicating findings across AST, taint, and regex engines
|
|
864
|
+
- **Context-Aware Filtering** - 80+ known safe modules (logging, testing, sanitizers) reduce false positives
|
|
865
|
+
- **`.scannerrc` Configuration** - YAML/JSON project config for suppressing rules, excluding paths, and setting severity thresholds
|
|
866
|
+
- **`scan_git_diff` Tool** - Scan only changed files in git diff for PR workflows and pre-commit hooks
|
|
867
|
+
- **`scan_project` Tool** - Project-level scanning with A-F security grading and aggregated metrics
|
|
868
|
+
- **`init-hooks` CLI** - `npx agent-security-scanner-mcp init-hooks` installs Claude Code post-tool-use hooks for automatic scanning
|
|
869
|
+
- **Safe Fix Validation** - `validateFix()` ensures auto-fixes don't introduce new vulnerabilities
|
|
870
|
+
- **Cross-File Taint Analysis** - Import graph tracking for dataflow analysis across module boundaries
|
|
871
|
+
|
|
872
|
+
### v3.3.0
|
|
873
|
+
- **OpenClaw Integration** - Full support with 30+ rules targeting autonomous AI threats
|
|
874
|
+
- **OpenClaw-Specific Rules** - Data exfiltration, credential theft, messaging abuse, unsafe automation detection
|
|
875
|
+
|
|
594
876
|
### v3.2.0
|
|
595
877
|
- **Token Optimization** - New `verbosity` parameter for all tools reduces context window usage by up to 98%
|
|
596
878
|
- **Three Verbosity Levels** - `minimal` (~50 tokens), `compact` (~200 tokens, default), `full` (~2,500 tokens)
|
|
@@ -637,4 +919,4 @@ npm install -g agent-security-scanner-mcp-full
|
|
|
637
919
|
|
|
638
920
|
## License
|
|
639
921
|
|
|
640
|
-
MIT
|
|
922
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-security-scanner-mcp",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"mcpName": "io.github.sinewaveai/agent-security-scanner-mcp",
|
|
5
5
|
"description": "Security scanner MCP server for AI coding agents. Prompt injection firewall, package hallucination detection (4.3M+ packages), 1000+ vulnerability rules with AST & taint analysis, auto-fix. For Claude Code, Cursor, Windsurf, Cline.",
|
|
6
6
|
"main": "index.js",
|