Skip to content

security(mcp): find_documents and count_documents can read system.* collections that list_collections hides #1774

Closed

Description

@ZhuchkaTriplesix

Problem

`McpMongoService.listCollections` drops names starting with `system.`, but `_knownCollection`, which validates the collection of `find_documents` and `count_documents`, checks against the unfiltered `session.listCollections()`. A client can name `system.profile` (past queries with their literals), `system.views` or any `system.*` collection of the connection's database even though it is hidden from the list.

Fix

Apply the same `system.` filter in `_knownCollection` (one helper used by both). Test: `find` and `count` on `system.profile` are refused with the same message as an unknown collection.

Found in the MCP review (see #1769 for the SQL guard).

Activity

  1. added
    bugSomething isn't working
    P2Medium priority / Parity & Refactoring
    securitySecurity related
    on Oct 25, 2026
  2. added a commit that references this issue on Oct 25, 2026
  3. ZhuchkaTriplesix commented on Oct 25, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Fixed on dev in #1784 (merged). Closing by hand: the PRs target dev, so GitHub would only close this when dev is merged into main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priority / Parity & RefactoringbugSomething isn't workingsecuritySecurity related

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions