mcpshield-agent 0.3.0__tar.gz → 0.4.0__tar.gz

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.
Files changed (22) hide show
  1. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/PKG-INFO +1 -1
  2. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/__init__.py +1 -1
  3. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/risk_scorer.py +34 -0
  4. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent.egg-info/PKG-INFO +1 -1
  5. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/README.md +0 -0
  6. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/__main__.py +0 -0
  7. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/cli.py +0 -0
  8. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/client.py +0 -0
  9. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/config.py +0 -0
  10. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/scanner.py +0 -0
  11. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent/tool_scanner.py +0 -0
  12. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent.egg-info/SOURCES.txt +0 -0
  13. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent.egg-info/dependency_links.txt +0 -0
  14. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent.egg-info/entry_points.txt +0 -0
  15. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent.egg-info/requires.txt +0 -0
  16. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/mcpshield_agent.egg-info/top_level.txt +0 -0
  17. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/pyproject.toml +0 -0
  18. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/setup.cfg +0 -0
  19. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/tests/test_cli.py +0 -0
  20. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/tests/test_client.py +0 -0
  21. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/tests/test_risk_scorer.py +0 -0
  22. {mcpshield_agent-0.3.0 → mcpshield_agent-0.4.0}/tests/test_scanner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcpshield-agent
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: MCPShield Agent - AI Agent Security Scanner for MCP servers
5
5
  Author-email: David Cooper <hello@mcpshield.app>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  """MCPShield Agent - AI Agent Security Scanner"""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.4.0"
4
4
  __author__ = "David Cooper"
5
5
  __email__ = "hello@mcpshield.app"
6
6
 
@@ -56,6 +56,34 @@ _SENSITIVE_ENV_RE = re.compile(
56
56
  re.IGNORECASE,
57
57
  )
58
58
 
59
+ # High-confidence hardcoded-secret patterns, matched against the command string
60
+ # so a credential embedded in an MCP config (e.g. an inline DB password) is
61
+ # flagged. Only the credential TYPE is surfaced — values are never captured.
62
+ _SECRET_PATTERNS = [
63
+ (re.compile(r"AKIA[0-9A-Z]{16}"), "AWS access key"),
64
+ (re.compile(r"ghp_[A-Za-z0-9]{36}"), "GitHub token"),
65
+ (re.compile(r"github_pat_[A-Za-z0-9_]{22,}"), "GitHub token"),
66
+ (re.compile(r"xox[baprs]-[A-Za-z0-9-]{10,}"), "Slack token"),
67
+ (re.compile(r"sk-ant-[A-Za-z0-9_-]{20,}"), "Anthropic API key"),
68
+ (re.compile(r"sk-(?!ant-)[A-Za-z0-9]{20,}"), "OpenAI API key"),
69
+ (re.compile(r"AIza[0-9A-Za-z_-]{35}"), "Google API key"),
70
+ (re.compile(r"-----BEGIN [A-Z ]*PRIVATE KEY-----"), "private key"),
71
+ (
72
+ re.compile(r"(?:postgres(?:ql)?|mysql|mongodb(?:\+srv)?|redis|amqp)://[^\s:@/]+:[^\s@/]+@"),
73
+ "inline database password",
74
+ ),
75
+ ]
76
+
77
+
78
+ def _detect_secrets(text: str) -> list[str]:
79
+ """Distinct TYPES of hardcoded secrets found in `text` (never the values)."""
80
+ found: list[str] = []
81
+ for pattern, label in _SECRET_PATTERNS:
82
+ if label not in found and pattern.search(text):
83
+ found.append(label)
84
+ return found
85
+
86
+
59
87
  # Server-type pattern sets (kept as sets for O(1) substring check on short strings)
60
88
  _SHELL_TYPE_PATTERNS = frozenset(["shell", "terminal", "command", "exec"])
61
89
  _NETWORK_TYPE_PATTERNS = frozenset(["http", "fetch", "api", "browser"])
@@ -90,6 +118,7 @@ WEIGHTS = {
90
118
  "no_description": 3,
91
119
  "docker_access": 20,
92
120
  "database_access": 15,
121
+ "hardcoded_secret": 30,
93
122
  }
94
123
 
95
124
 
@@ -212,6 +241,11 @@ def _analyze_command(command: str) -> dict[str, Any]:
212
241
  score += 15
213
242
  factors.append("Elevated privileges (sudo)")
214
243
 
244
+ hardcoded = _detect_secrets(command)
245
+ if hardcoded:
246
+ score += min(len(hardcoded), 2) * WEIGHTS["hardcoded_secret"]
247
+ factors.append(f"Hardcoded credential in config: {', '.join(hardcoded[:3])}")
248
+
215
249
  return {"score": score, "factors": factors}
216
250
 
217
251
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcpshield-agent
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: MCPShield Agent - AI Agent Security Scanner for MCP servers
5
5
  Author-email: David Cooper <hello@mcpshield.app>
6
6
  License-Expression: MIT