Skip to content

fix(mcp): hardening gaps of the review (#1776) - #1802

Merged
ZhuchkaTriplesix merged 2 commits into
devfrom
fix/mcp-hardening-1776
Oct 25, 2026
Merged

ZhuchkaTriplesix merged 2 commits into
devfrom
fix/mcp-hardening-1776

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Part of #1776. Done:

  • McpSocketHost: an authenticated line longer than maxLineBytes (4 MiB) closes the connection instead of buffering without bound; at most maxSessions (16) authenticated connections, more get 'Too many Querya MCP sessions.'.
  • McpServerController._start: if host.start() throws after binding the socket, the host is stopped instead of listening with a token nobody has.
  • McpServerController._persist: the activity write is no longer a bare unawaited; its error is logged.
  • McpAccessStore.setReadable: calls run one after another, so two quick toggles do not lose one.
  • McpMongoGuard: list items count toward maxKeys, so a huge $in is refused.

Not done here, still open in #1776: Mongo maxTimeMS and a total response size cap (the session interface has no way to pass the option yet), and masking the connection's own secrets for non-tool exceptions in _guarded. The access-store serialization has no test: it needs the local database. Not run locally, CI will.

…activity persist errors are logged, concurrent access toggles do not lose one, a huge list is refused (#1776)
@github-actions github-actions Bot added bug Something isn't working P3 Low priority / Polish & Enhancements security Security related labels Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working P3 Low priority / Polish & Enhancements security Security related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant