mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
feat: OSV malware check for MCP extension packages (#5305)
Before launching an MCP server via npx/uvx, queries the OSV (Open Source Vulnerabilities) API to check if the package has known malware advisories (MAL-* IDs). Regular CVEs are ignored — only confirmed malware is blocked. - Free, public API (Google-maintained), ~300ms per query - Runs once per MCP server launch, inside _run_stdio() before subprocess spawn - Parallel with other MCP servers (asyncio.gather already in place) - Fail-open: network errors, timeouts, unrecognized commands → allow - Parses npm (scoped @scope/pkg@version) and PyPI (name[extras]==version) Inspired by Block/goose extension malware check.
This commit is contained in:
parent
b63fb03f3f
commit
4494fba140
3 changed files with 334 additions and 0 deletions
|
|
@ -833,6 +833,15 @@ class MCPServerTask:
|
|||
|
||||
safe_env = _build_safe_env(user_env)
|
||||
command, safe_env = _resolve_stdio_command(command, safe_env)
|
||||
|
||||
# Check package against OSV malware database before spawning
|
||||
from tools.osv_check import check_package_for_malware
|
||||
malware_error = check_package_for_malware(command, args)
|
||||
if malware_error:
|
||||
raise ValueError(
|
||||
f"MCP server '{self.name}': {malware_error}"
|
||||
)
|
||||
|
||||
server_params = StdioServerParameters(
|
||||
command=command,
|
||||
args=args,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue