correctover-scan 2.1.3 → 3.1.0

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/LICENSE ADDED
@@ -0,0 +1,68 @@
1
+ Copyright (c) 2026 Guigui Wang.
2
+
3
+ Elastic License 2.0
4
+ URL: https://www.elastic.co/licensing/elastic-license
5
+ ## Acceptance
6
+ By using the software, you agree to all of the terms and conditions below.
7
+ ## Copyright License
8
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
9
+ non-sublicensable, non-transferable license to use, copy, distribute, make
10
+ available, and prepare derivative works of the software, in each case subject to
11
+ the limitations and conditions below.
12
+ ## Limitations
13
+ You may not provide the software to third parties as a hosted or managed
14
+ service, where the service provides users with access to any substantial set of
15
+ the features or functionality of the software.
16
+ You may not move, change, disable, or circumvent the license key functionality
17
+ in the software, and you may not remove or obscure any functionality in the
18
+ software that is protected by the license key.
19
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
20
+ of the licensor in the software. Any use of the licensor’s trademarks is subject
21
+ to applicable law.
22
+ ## Patents
23
+ The licensor grants you a license, under any patent claims the licensor can
24
+ license, or becomes able to license, to make, have made, use, sell, offer for
25
+ sale, import and have imported the software, in each case subject to the
26
+ limitations and conditions in this license. This license does not cover any
27
+ patent claims that you cause to be infringed by modifications or additions to
28
+ the software. If you or your company make any written claim that the software
29
+ infringes or contributes to infringement of any patent, your patent license for
30
+ the software granted under these terms ends immediately. If your company makes
31
+ such a claim, your patent license ends immediately for work on behalf of your
32
+ company.
33
+ ## Notices
34
+ You must ensure that anyone who gets a copy of any part of the software from you
35
+ also gets a copy of these terms.
36
+ If you modify the software, you must include in any modified copies of the
37
+ software prominent notices stating that you have modified the software.
38
+ ## No Other Rights
39
+ These terms do not imply any licenses other than those expressly granted in
40
+ these terms.
41
+ ## Termination
42
+ If you use the software in violation of these terms, such use is not licensed,
43
+ and your licenses will automatically terminate. If the licensor provides you
44
+ with a notice of your violation, and you cease all violation of this license no
45
+ later than 30 days after you receive that notice, your licenses will be
46
+ reinstated retroactively. However, if you violate these terms after such
47
+ reinstatement, any additional violation of these terms will cause your licenses
48
+ to terminate automatically and permanently.
49
+ ## No Liability
50
+ *As far as the law allows, the software comes as is, without any warranty or
51
+ condition, and the licensor will not be liable to you for any damages arising
52
+ out of these terms or the use or nature of the software, under any kind of
53
+ legal claim.*
54
+ ## Definitions
55
+ The **licensor** is the entity offering these terms, and the **software** is the
56
+ software the licensor makes available under these terms, including any portion
57
+ of it.
58
+ **you** refers to the individual or entity agreeing to these terms.
59
+ **your company** is any legal entity, sole proprietorship, or other kind of
60
+ organization that you work for, plus all organizations that have control over,
61
+ are under the control of, or are under common control with that
62
+ organization. **control** means ownership of substantially all the assets of an
63
+ entity, or the power to direct its management and policies by vote, contract, or
64
+ otherwise. Control can be direct or indirect.
65
+ **your licenses** are all the licenses granted to you for the software under
66
+ these terms.
67
+ **use** means anything you do requiring one of your licenses.
68
+ **trademark** means trademarks, service marks, and similar rights.
package/README.md CHANGED
@@ -1,45 +1,221 @@
1
1
  # correctover-scan
2
2
 
3
- MCP / DSH configuration security scanner — part of the
4
- [Correctover](https://www.npmjs.com/package/correctover) runtime verification
5
- suite. Delegates core checks to the maintained `correctover` engine.
3
+ ## License
6
4
 
7
- ## Quick try (no install)
5
+ Copyright (c) 2026 Guigui Wang.
8
6
 
9
- ```sh
10
- npx correctover-scan
7
+ Starting with version **3**, this project is licensed under the
8
+ **Elastic License 2.0** (SPDX: `Elastic-2.0`). You may use, modify, and
9
+ self-host the software, but you may not offer it to third parties as a hosted
10
+ or managed service. See [LICENSE](LICENSE) for the full terms.
11
+
12
+ All versions released before 3 (including the 1.x line and the 2.x
13
+ compatibility shells) remain available under their original license terms;
14
+ the license change is not retroactive.
15
+
16
+
17
+ [![Rekor anchored](https://img.shields.io/badge/Rekor%20anchored-logIndex%202697131671-1455A3)](https://search.sigstore.dev/?logIndex=2697131671)
18
+
19
+ > Security scanner for MCP servers and AI agents — detects credential exposure, SSRF, command injection risk and missing auth across your MCP configuration. 14 checks mapped to OWASP AISVS 1.0. Run anywhere with `npx correctover-scan`.
20
+
21
+ ![npm](https://img.shields.io/npm/v/correctover-scan)
22
+ ![license](https://img.shields.io/npm/l/correctover-scan) [![IETF Internet-Draft](https://img.shields.io/badge/IETF-draft--correctover--ccs-blue)](https://datatracker.ietf.org/doc/draft-correctover-ccs/)
23
+
24
+ ---
25
+
26
+ ### Verifiable artifacts behind this tool
27
+
28
+ - **Third-party interoperability** — joint assessment merged into the [EMILIA protocol](https://github.com/emiliaprotocol/emilia-protocol/pull/693)
29
+ - **66 signed conformance test vectors** — reproducible by anyone: [ccs-conformance-vectors](https://github.com/DSHCorrectover/ccs-conformance-vectors)
30
+ - **Published methodology** — [Zenodo DOI 10.5281/zenodo.21783723](https://doi.org/10.5281/zenodo.21783723)
31
+ - **Need a human audit?** — 116-check manual audit methodology, 5-day turnaround: [Agent Output Audit](https://correctover.com/agent-audit.html)
32
+
33
+ `correctover-scan` audits the MCP (Model Context Protocol) configuration files used by Claude Code, Claude Desktop, Cursor, VS Code and other AI agent tools. It scans for credential leaks, SSRF exposure, missing transport encryption, over-broad tool permissions and more — 14 security checks covering the issues that turn MCP integrations into RCE, data exfiltration and prompt-injection paths. Zero install: `npx correctover-scan` runs locally, works in CI, and outputs SARIF for GitHub code scanning.
34
+
35
+ **v1.4.0** adds a second mode: `--bundle` code-layer signal scanning for published npm packages and bundled/minified JavaScript — 17 checks over shipped code, with [file+line findings, minified-code reformatting and context-based false-positive suppression](#-bundle--published-package-code-scan-v140).
36
+
37
+ ## ⚡ Quick Start — running in 30 seconds
38
+
39
+ Zero config, no account, no sign-up — scan the current directory for MCP configuration issues:
40
+
41
+ ```bash
42
+ npx correctover-scan@latest
43
+ ```
44
+
45
+ It auto-detects MCP config files (`.cursor/mcp.json`, `claude_desktop_config.json`, `.claude/mcp.json`, `mcp.json`, `.vscode/mcp.json` and more) and runs 14 checks. Everything runs locally on your machine — config files are not uploaded.
46
+
47
+ ```bash
48
+ # Scan a specific config file
49
+ npx correctover-scan mcp.json
50
+
51
+ # Recursively scan a project directory
52
+ npx correctover-scan -d ./my-project -r
53
+
54
+ # SARIF output for GitHub code scanning
55
+ npx correctover-scan mcp.json -f sarif > report.sarif
11
56
  ```
12
57
 
13
- Runs a built-in demo against 5 sample MCP server configurations and prints
14
- every CRITICAL / HIGH issue it finds.
58
+ ## What It Checks
59
+
60
+ | # | Check | Severity | AISVS |
61
+ |---|-------|----------|-------|
62
+ | 1 | TLS Transport Encryption | 🔴 Critical | C10.1 |
63
+ | 2 | Server Authentication | 🟠 High | C10.2 |
64
+ | 3 | Timeout Configuration | 🟡 Medium | C9.1 |
65
+ | 4 | Credential Exposure | 🔴 Critical | C5.1 |
66
+ | 5 | Tool Allowlist | 🟠 High | C9.3 |
67
+ | 6 | Token Budget Control | 🟠 High | C9.1 |
68
+ | 7 | SSRF Protection | 🔴 Critical | C10.3 |
69
+ | 8 | Audit Logging | 🟡 Medium | C12.1 |
70
+ | 9 | Sandbox Isolation | 🟡 Medium | C4.1 |
71
+ | 10 | Dependency Version Pinning | 🟡 Medium | C6.1 |
72
+ | 11 | Error Handling Strategy | 🟡 Medium | C12.2 |
73
+ | 12 | Input Validation | 🟠 High | C2.1 |
74
+ | 13 | Output Validation | 🟡 Medium | C7.1 |
75
+ | 14 | Kill Switch | 🟠 High | C9.5 |
76
+
77
+ ## Output Formats
78
+
79
+ ```bash
80
+ # Terminal (default)
81
+ correctover-scan mcp.json
15
82
 
16
- ## Scan your own config
83
+ # JSON
84
+ correctover-scan mcp.json -f json
17
85
 
18
- ```sh
19
- npx correctover-scan ./mcp.json
20
- npx correctover-scan ./mcp.json --format json
86
+ # SARIF (for CI integration)
87
+ correctover-scan mcp.json -f sarif > report.sarif
21
88
  ```
22
89
 
23
- ## What it detects
90
+ ## Supported Config Files
24
91
 
25
- - **CRITICAL** — `curl | sh`, `wget | sh`, `rm -rf /`, `eval(...)`,
26
- `os.system`, `subprocess`, `chmod 777`, `sudo`, command substitution with
27
- network calls
28
- - **HIGH** — stdio transport leaking env vars, sensitive env names
29
- (`API_KEY` / `SECRET` / `TOKEN` / `PASSWORD` / ...), plaintext HTTP URLs
30
- - Engine-delegated schema / transport checks from `correctover`
92
+ Auto-detects these files:
93
+ - `.cursor/mcp.json`
94
+ - `claude_desktop_config.json`
95
+ - `.claude/mcp.json`
96
+ - `mcp.json` / `mcp.yaml` / `mcp.yml`
97
+ - `.vscode/mcp.json`
98
+ - `.mcp/mcp.json`
99
+ - `config/mcp.json`
31
100
 
32
- ## Runtime protection
101
+ ## 📦 Bundle / published-package code scan (v1.4.0)
33
102
 
34
- The scanner is the static front door. For runtime enforcement inside
35
- DeepSeek Harness (DSH) or any MCP-based agent:
103
+ ### Usage
36
104
 
37
- ```sh
38
- npm install correctover
39
- # DSH users:
40
- dsh plugin add dsh-correctover
105
+ ```bash
106
+ # Audit an unpacked npm package: reads package.json entry (main/module/bin)
107
+ # and every .js/.mjs/.cjs/.ts file in the tree (node_modules skipped)
108
+ npx correctover-scan@latest --bundle ./node_modules/some-pkg
109
+ npx correctover-scan@latest -b ./pkg # -b is shorthand for --bundle
110
+
111
+ # Audit a single minified/bundled JS file
112
+ npx correctover-scan@latest --bundle dist/app.min.js
113
+
114
+ # A positional .js/.mjs/.cjs/.ts target auto-selects bundle mode
115
+ npx correctover-scan@latest ./cli.js
116
+
117
+ # Outputs: text (default), JSON, or SARIF with file+line locations
118
+ npx correctover-scan@latest -b ./pkg -f json
119
+ npx correctover-scan@latest -b ./pkg -f sarif > bundle.sarif
120
+ npx correctover-scan@latest -b ./pkg -o report.txt # write the report to a file
121
+ npx correctover-scan@latest -b ./pkg -f json -o bundle.json
41
122
  ```
42
123
 
43
- CCS 7-dimension verification standard (IETF draft
44
- [draft-correctover-ccs](https://datatracker.ietf.org/doc/draft-correctover-ccs/)):
45
- Structure · Schema · Latency · Cost · Identity · Integrity · Security.
124
+ Exit code is `1` when any check produces a fail-level finding — drop the command straight into CI.
125
+
126
+ ### What bundle mode is — and what it is not
127
+
128
+ Bundle mode is **signal scanning over shipped/minified code**. Minifiers rename local variables, but property names, string literals, URLs, environment-variable names and error messages survive bundling — so the attack-surface signals the checks rely on are still present in the published artifact.
129
+
130
+ - **12 automatic checks** return a verdict (pass / warn / fail) — hardcoded secrets, cloud-metadata/SSRF, `shell:true`/`exec` subprocess calls, dynamic `eval`/`Function`/`vm`, plaintext endpoints, MCP transport auth, permission gates, missing timeouts/kill-switch/input validation, env-credential flow, sandbox signals.
131
+ - **5 semi-automatic checks** (token budget, audit logging/telemetry, supply-chain/SBOM, error handling/retry, output truncation/filtering) **enumerate the signals** they find in shipped code — the signal's presence is verifiable, but whether the control is actually enforced needs human review. Those signals are listed in the JSON output and never counted as fails.
132
+ - Every finding is grounded at **file + line with a code snippet**. Minified files are detected and lightly reformatted internally (statement/block expansion, no dependencies) so line numbers stay usable; already-formatted source is scanned untouched.
133
+ - Known-benign patterns are suppressed with context heuristics and reported as info — for example cloud-SDK metadata credential providers (AWS IMDS / GCP metadata), `shell:false` fixed-argument spawn calls, sandbox VM implementations, localhost/spec-namespace URLs and placeholder/example strings.
134
+
135
+ **Honest scope:** bundle mode does not prove reachability or intent — a signal that is located correctly may still be unreachable in practice, and conclusions on the semi-automatic checks remain a manual-review job. It is an automated triage layer that points a reviewer at the exact lines to examine; it does **not** replace the **116-check manual audit methodology**, where reviewers trace data flow and what each capability can actually be made to do. Scanning covers JavaScript/TypeScript code, configuration and protocol-layer signals; deep logic compiled into native binaries (e.g. Bun `--compile` single-file executables) is outside static analysis and is not covered by bundle mode. Everything runs locally — package code is not uploaded.
136
+
137
+ ### Bundle checks (17)
138
+
139
+ Check ids continue the config scanner's 14-check scheme so text/JSON/SARIF outputs stay aligned.
140
+
141
+ | # | Check | Type | Severity | AISVS |
142
+ |---|-------|------|----------|-------|
143
+ | 1 | Hardcoded credentials in code (sk-/ghp_/AKIA/AIza/xox patterns, placeholder-aware) | automatic | 🔴 Critical | C5.1 |
144
+ | 2 | Plaintext HTTP outbound endpoints (localhost/spec/example hosts suppressed) | automatic | 🟠 High | C10.1 |
145
+ | 3 | Cloud metadata & intranet addresses / SSRF (169.254.x, RFC1918, GCP metadata; cloud-SDK & guard context suppressed) | automatic | 🔴 Critical | C10.3 |
146
+ | 4 | Subprocess execution — `shell:true` / `exec` (`shell:false` fixed-arg spawn not flagged) | automatic | 🟠 High | C4.1 |
147
+ | 5 | Dynamic code execution — `eval` / `new Function` / `vm` (sandbox/shim contexts suppressed) | automatic | 🟠 High | C4.1 |
148
+ | 6 | Environment-variable credential flow (hardcoded fallback secrets flagged) | automatic | 🟡 Medium | C5.1 |
149
+ | 7 | Permission modes & tool gates (`allowedTools`, `dangerouslySkipPermissions`) | automatic | 🟠 High | C9.3 |
150
+ | 8 | MCP transport authentication (remote sse/http/ws without Authorization signal) | automatic | 🟠 High | C10.2 |
151
+ | 9 | Timeout & interruption signals (`AbortSignal.timeout` / `timeout` options) | automatic | 🟡 Medium | C9.1 |
152
+ | 10 | Kill switch — `AbortController` / `AbortSignal` presence | automatic | 🟠 High | C9.5 |
153
+ | 11 | Sandbox isolation signals (bwrap / sandbox manager) | automatic | 🟡 Medium | C4.1 |
154
+ | 12 | Input validation / schema signals | automatic | 🟠 High | C2.1 |
155
+ | 13 | Token budget constants (`MAX_*_TOKENS` / cost limits) | semi-automatic | 🟠 High | C9.1 |
156
+ | 14 | Audit logging / telemetry endpoints | semi-automatic | 🟡 Medium | C12.1 |
157
+ | 15 | Supply chain / vendor SBOM (native artifacts, vendor versions) | semi-automatic | 🟡 Medium | C6.1 |
158
+ | 16 | Error handling / retry / fallback | semi-automatic | 🟡 Medium | C12.2 |
159
+ | 17 | Output truncation / filtering | semi-automatic | 🟡 Medium | C7.1 |
160
+
161
+ The free-tier daily scan allowance applies to bundle scans too (counted the same way as config scans); a Pro license removes the limit. License verification runs sub-millisecond on the core verification hot path.
162
+
163
+ ## CI/CD Integration
164
+
165
+ ### GitHub Actions
166
+
167
+ ```yaml
168
+ - uses: DSHCorrectover/correctover-scan-action@v1
169
+ with:
170
+ path: ./mcp.json
171
+ ```
172
+
173
+ ### Web Scanner
174
+
175
+ Try the no-install browser version (files never leave your machine): [in-browser scanner](https://correctover.com/scan.html)
176
+
177
+ ## Standards Compliance
178
+
179
+ - **OWASP AISVS 1.0** — AI System Vulnerability Severity
180
+ - **GB/T《智能体应用安全基本要求》** — Chinese National Mandatory Standard
181
+
182
+ ## Manual audit
183
+
184
+ The free automated scan covers surface-level configuration checks. A manual Correctover audit goes deeper:
185
+
186
+ - **116-check manual audit methodology** — reviewers trace what each MCP tool can actually be made to do, not just whether a config field is present
187
+ - Findings grounded in **real MCP ecosystem CVEs**
188
+ - **5-day turnaround**, delivered as a PDF report with recommended fixes
189
+ - A **free 1-page summary** of your configuration first — you decide whether to continue after reading it
190
+
191
+ For first customers, if the manual audit finds no critical-severity issue, you pay nothing.
192
+
193
+ - Get your free 1-page summary: email [wangguigui@correctover.com](mailto:wangguigui@correctover.com?subject=Free%20Scan%20summary%20request)
194
+ - Learn more about the manual audit: https://correctover.com/agent-audit.html
195
+
196
+ ## Links
197
+
198
+ - [correctover.com](https://correctover.com) — AI Agent Runtime Assurance
199
+ - [CCS Standard](https://correctover.com/ccs) — Conformance Specification
200
+ - [Web Scanner](https://correctover.com/scan.html) — In-browser version, no upload
201
+ - [GitHub](https://github.com/DSHCorrectover) — Source code
202
+ - [Conformance test vectors](https://github.com/DSHCorrectover/ccs-conformance-vectors) — 66 signed, reproducible
203
+ - [EMILIA interoperability](https://github.com/emiliaprotocol/emilia-protocol/pull/693) — merged joint assessment
204
+ - [Framework paper (Zenodo)](https://doi.org/10.5281/zenodo.21783723) — DOI 10.5281/zenodo.21783723
205
+ - [Agent Output Audit](https://correctover.com/agent-audit.html) — 116-check manual audit, 5-day turnaround
206
+
207
+ ## Specification
208
+
209
+ CCS (Correctover Conformance Shape) is published as an individual Internet-Draft: **[draft-correctover-ccs](https://datatracker.ietf.org/doc/draft-correctover-ccs/)**.
210
+
211
+ An Internet-Draft is an individual submission. It is not an RFC, an adopted working-group item, or IETF endorsement; the Datatracker page is authoritative for revision and status.
212
+
213
+ ## License & scope
214
+
215
+ Elastic License 2.0 © Guigui Wang.
216
+
217
+ This CLI is free to use, modify and self-host under the Elastic License 2.0:
218
+ use it in your terminal, CI, and agent hooks (such as the [Kimi Code security hook](https://github.com/DSHCorrectover/kimi-code-security-hook)), and redistribute it under those terms. You may not offer it to third parties as a hosted or managed service. External pull requests are welcome. See [LICENSE](LICENSE) for the full terms.
219
+
220
+ The commercial products — the hosted zero-upload scan platform, the CCS runtime verification engine, and the manual Agent Output Audit service — are proprietary and are not part of this release. See [correctover.com](https://correctover.com) for those.
221
+