Skip to content

[Bug]: CONFLUENCE_SPACES_FILTER is only enforced in confluence_search, not in other Confluence read tools #1495

Description

@gsobczyk

Prerequisites

  • I have searched the existing issues to make sure this bug has not already been reported.
  • I have checked the README for relevant information.

Bug Description

CONFLUENCE_SPACES_FILTER is documented (.env.example:233) as limiting "searches and other operations" to an allowlist of spaces, but the code only enforces it inside confluence_search. Every other Confluence read tool (confluence_get_page, confluence_get_space_page_tree, confluence_get_page_children, confluence_get_page_ancestors, confluence_get_comments, etc.) ignores the filter entirely, so an agent (or user) can trivially read content from spaces outside the configured allowlist as long as the underlying credentials have access.

Steps to Reproduce

  1. Set CONFLUENCE_SPACES_FILTER=ANYSPACE (a single, narrow space).
  2. Ask an MCP client to search for content that actually lives in a different space (e.g. OTHERSPACE).
  3. confluence_search correctly returns an empty result set — the filter works as intended here.
  4. The agent falls back to confluence_get_space_page_tree(space_key=OTHERSPACE, ...) and then confluence_get_page(page_id=...) for a page found in that tree.
  5. Both calls succeed and return full page content from OTHERSPACE, even though it's outside the configured CONFLUENCE_SPACES_FILTER allowlist.

Expected Behavior

CONFLUENCE_SPACES_FILTER should be a hard boundary enforced consistently across all Confluence tools that accept or resolve a space_key/page, not just confluence_search. Compare with the Jira equivalent (JIRA_PROJECTS_FILTER), which is enforced both in search (src/mcp_atlassian/jira/search.py) and in direct single-item lookups — jira_get_issue explicitly rejects issues whose project prefix isn't in the allowlist (src/mcp_atlassian/jira/issues.py:104-123).

Actual Behavior

Only `confluence_search` applies the filter, via `SearchMixin.search()` (`src/mcp_atlassian/confluence/search.py:113-115`):


for filter_str in (self.config.spaces_filter, spaces_filter):
    if filter_str:
        cql = self._and_spaces_filter(cql, filter_str)


No equivalent check exists in `src/mcp_atlassian/confluence/pages.py`, which backs `get_page`, `get_space_page_tree`, `get_page_children`, `get_child_pages`, `create_page`, etc. — none of these read `self.config.spaces_filter` at all.

mcp-atlassian Version

v0.22.1

Installation Method

From PyPI (pip install mcp-atlassian / uv add mcp-atlassian)

Operating System

Linux (Specify distribution below if relevant)

Python Version

3.14.4

Atlassian Instance Type

Confluence Server / Data Center

Client Application

opencode + mcp via uvx

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions