eslint-plugin-mcp-sdk-security 0.3.0 → 0.3.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 +46 -3
- package/package.json +2 -2
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,45 @@ Security rules for code built on [`@modelcontextprotocol/sdk`](https://www.npmjs
|
|
|
31
31
|
|
|
32
32
|
**Interlace** fosters **strength through integration**. Instead of stacking isolated rules, we **interlace** security directly into your workflow to create a resilient fabric of code. We believe tools should **guide rather than gatekeep**, providing educational feedback that strengthens the developer with every interaction.
|
|
33
33
|
|
|
34
|
+
<!-- AUTO-GENERATED:DOCTRINE:START - Do not edit manually -->
|
|
35
|
+
|
|
36
|
+
## Why these rules are quiet
|
|
37
|
+
|
|
38
|
+
**Noise creates apathy, and apathy is not a security posture.** A linter that reports
|
|
39
|
+
a thousand things a week gets switched off in a month, and the real finding goes with
|
|
40
|
+
it. So every rule here is built to be worth reading: we would rather miss a finding
|
|
41
|
+
than spend your attention on one that was never real.
|
|
42
|
+
|
|
43
|
+
That is a trade, and it is made deliberately. It costs recall, and we measure what it
|
|
44
|
+
costs rather than assuming it is free.
|
|
45
|
+
|
|
46
|
+
## How the rules decide
|
|
47
|
+
|
|
48
|
+
**Evidence, not names.** A rule fires on what the code *does*, resolved through the
|
|
49
|
+
AST and ESLint's own scope analysis — not on an identifier that happens to contain
|
|
50
|
+
`query`, a method called `setItem`, or a file whose path contains `key`. Every one of
|
|
51
|
+
those was a real false positive in this ecosystem, found by reading our own output on
|
|
52
|
+
open-source projects and fixed with a test that fails on the unfixed rule.
|
|
53
|
+
|
|
54
|
+
Where a rule has known false-positive shapes, its page carries a **Not a finding**
|
|
55
|
+
section: what it deliberately stays quiet on, and what to check first when it fires
|
|
56
|
+
and you disagree.
|
|
57
|
+
|
|
58
|
+
## What you get
|
|
59
|
+
|
|
60
|
+
The rules below. Security rules carry a CWE mapping and, where one is assigned, a
|
|
61
|
+
CVSS score; every rule carries a fix on its message — in prose for a human and as
|
|
62
|
+
structured JSON for an agent. Install it, enable
|
|
63
|
+
`recommended`, and read the findings. If one of them is wrong,
|
|
64
|
+
[open an issue](https://github.com/ofri-peretz/eslint/issues) — a false positive is a
|
|
65
|
+
bug here, not a tuning exercise for you.
|
|
66
|
+
|
|
67
|
+
How that is measured, on which projects, and where it falls short:
|
|
68
|
+
[benchmark methodology](https://github.com/ofri-peretz/eslint/blob/main/BENCHMARK-METHODOLOGY.md)
|
|
69
|
+
and [results](https://github.com/ofri-peretz/eslint/blob/main/BENCHMARK-RESULTS.md).
|
|
70
|
+
|
|
71
|
+
<!-- AUTO-GENERATED:DOCTRINE:END -->
|
|
72
|
+
|
|
34
73
|
## Getting Started
|
|
35
74
|
|
|
36
75
|
- To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-mcp-sdk-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-mcp-sdk-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-mcp-sdk-security). 📚
|
|
@@ -111,10 +150,14 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md) fo
|
|
|
111
150
|
| 🟡 | **Type-aware (refining)**: pure-AST primary path; types refine precision. |
|
|
112
151
|
| 🟠 | **Type-aware (graceful)**: requires TS program; silent without it. |
|
|
113
152
|
|
|
153
|
+
<!-- AUTO-GENERATED:RULES_TABLE:START - Do not edit manually -->
|
|
114
154
|
| Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
115
|
-
| :--- |
|
|
116
|
-
| [
|
|
117
|
-
|
|
155
|
+
| :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
156
|
+
| [no-command-injection-in-tool](https://eslint.interlace.tools/docs/security/plugin-mcp-sdk-security/rules/no-command-injection-in-tool?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-mcp-sdk-security) | CWE-78 | A03:2021 | | Disallow an MCP tool argument being used directly as the command in a child_process call. | 🟢 | | | | | |
|
|
157
|
+
| [no-tool-description-injection](https://eslint.interlace.tools/docs/security/plugin-mcp-sdk-security/rules/no-tool-description-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-mcp-sdk-security) | CWE-1427 | A03:2021 | | Require MCP tool descriptions and titles to be static text, since they reach the model as instructions. | 🟢 | | | | | |
|
|
158
|
+
| [no-unvalidated-tool-args](https://eslint.interlace.tools/docs/security/plugin-mcp-sdk-security/rules/no-unvalidated-tool-args?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-mcp-sdk-security) | CWE-20 | A03:2021 | | Disallow a tool handler reading an argument its declared input schema does not include. | 🟢 | | | | | |
|
|
159
|
+
| [require-tool-input-schema](https://eslint.interlace.tools/docs/security/plugin-mcp-sdk-security/rules/require-tool-input-schema?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-mcp-sdk-security) | CWE-20 | A03:2021 | | Require an input schema when registering an MCP tool | 🟢 | | | | | |
|
|
160
|
+
<!-- AUTO-GENERATED:RULES_TABLE:END -->
|
|
118
161
|
<!-- INTERLACE:STAR_CTA:START -->
|
|
119
162
|
## ⭐ Support & follow
|
|
120
163
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-mcp-sdk-security",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "ESLint plugin for Model Context Protocol (MCP) SDK security — catches tools registered without an input schema, handlers reading arguments the schema never declared, model-visible descriptions built from dynamic text, and tool arguments reaching a shell.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@interlace/eslint-devkit": "^1.
|
|
77
|
+
"@interlace/eslint-devkit": "^1.17.3"
|
|
78
78
|
},
|
|
79
79
|
"funding": {
|
|
80
80
|
"type": "github",
|
package/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=exports.requireToolInputSchema=exports.noUnvalidatedToolArgs=exports.noToolDescriptionInjection=exports.noCommandInjectionInTool=void 0;var no_command_injection_in_tool_2=require("./rules/no-command-injection-in-tool");Object.defineProperty(exports,"noCommandInjectionInTool",{enumerable:true,get:function(){return no_command_injection_in_tool_2.noCommandInjectionInTool}});var no_tool_description_injection_2=require("./rules/no-tool-description-injection");Object.defineProperty(exports,"noToolDescriptionInjection",{enumerable:true,get:function(){return no_tool_description_injection_2.noToolDescriptionInjection}});var no_unvalidated_tool_args_2=require("./rules/no-unvalidated-tool-args");Object.defineProperty(exports,"noUnvalidatedToolArgs",{enumerable:true,get:function(){return no_unvalidated_tool_args_2.noUnvalidatedToolArgs}});var require_tool_input_schema_2=require("./rules/require-tool-input-schema");Object.defineProperty(exports,"requireToolInputSchema",{enumerable:true,get:function(){return require_tool_input_schema_2.requireToolInputSchema}});exports.rules={get"no-command-injection-in-tool"(){return require("./rules/no-command-injection-in-tool").noCommandInjectionInTool},get"no-tool-description-injection"(){return require("./rules/no-tool-description-injection").noToolDescriptionInjection},get"no-unvalidated-tool-args"(){return require("./rules/no-unvalidated-tool-args").noUnvalidatedToolArgs},get"require-tool-input-schema"(){return require("./rules/require-tool-input-schema").requireToolInputSchema}};exports.plugin={meta:{name:"eslint-plugin-mcp-sdk-security",version:"0.3.0"},rules:exports.rules};const minimalConfig={plugins:{"mcp-sdk-security":exports.plugin},rules:{"mcp-sdk-security/require-tool-input-schema":"error"}};const recommendedConfig={plugins:{"mcp-sdk-security":exports.plugin},rules:{"mcp-sdk-security/require-tool-input-schema":"error"}};const strictConfig={plugins:{"mcp-sdk-security":exports.plugin},rules:Object.fromEntries(Object.keys(exports.rules).map(ruleName=>[`mcp-sdk-security/${ruleName}`,"error"]))};exports.configs={minimal:minimalConfig,recommended:recommendedConfig,strict:strictConfig};exports.default={...exports.plugin,configs:exports.configs};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=exports.requireToolInputSchema=exports.noUnvalidatedToolArgs=exports.noToolDescriptionInjection=exports.noCommandInjectionInTool=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");var no_command_injection_in_tool_2=require("./rules/no-command-injection-in-tool");Object.defineProperty(exports,"noCommandInjectionInTool",{enumerable:true,get:function(){return no_command_injection_in_tool_2.noCommandInjectionInTool}});var no_tool_description_injection_2=require("./rules/no-tool-description-injection");Object.defineProperty(exports,"noToolDescriptionInjection",{enumerable:true,get:function(){return no_tool_description_injection_2.noToolDescriptionInjection}});var no_unvalidated_tool_args_2=require("./rules/no-unvalidated-tool-args");Object.defineProperty(exports,"noUnvalidatedToolArgs",{enumerable:true,get:function(){return no_unvalidated_tool_args_2.noUnvalidatedToolArgs}});var require_tool_input_schema_2=require("./rules/require-tool-input-schema");Object.defineProperty(exports,"requireToolInputSchema",{enumerable:true,get:function(){return require_tool_input_schema_2.requireToolInputSchema}});exports.rules={get"no-command-injection-in-tool"(){return require("./rules/no-command-injection-in-tool").noCommandInjectionInTool},get"no-tool-description-injection"(){return require("./rules/no-tool-description-injection").noToolDescriptionInjection},get"no-unvalidated-tool-args"(){return require("./rules/no-unvalidated-tool-args").noUnvalidatedToolArgs},get"require-tool-input-schema"(){return require("./rules/require-tool-input-schema").requireToolInputSchema}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-mcp-sdk-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-mcp-sdk-security",version:"0.3.0"},rules:exports.rules};const minimalConfig={plugins:{"mcp-sdk-security":exports.plugin},rules:{"mcp-sdk-security/require-tool-input-schema":"error"}};const recommendedConfig={plugins:{"mcp-sdk-security":exports.plugin},rules:{"mcp-sdk-security/require-tool-input-schema":"error"}};const strictConfig={plugins:{"mcp-sdk-security":exports.plugin},rules:Object.fromEntries(Object.keys(exports.rules).map(ruleName=>[`mcp-sdk-security/${ruleName}`,"error"]))};exports.configs={minimal:minimalConfig,recommended:recommendedConfig,strict:strictConfig};exports.default={...exports.plugin,configs:exports.configs};
|