Skip to content

MCP server: require API key in production #51

Description

@askmy-stack

Background

Identified during OSS audit v2 of cortex. When CORTEX_API_KEY is unset, mcp/server.js sends x-cortex-roles from CORTEX_CALLER_ROLES env (default authenticated). api/deps.py trusts this header in open mode.

Problem Statement

Any process with MCP env access can escalate to admin/gdpr_officer and invoke POST /gdpr/erase without a real API key.

Proposed Solution

Require CORTEX_API_KEY for MCP in non-development environments; log warning and refuse GDPR-adjacent tools without key; document in mcp/Dockerfile and .env.example.

Acceptance Criteria

  • ENVIRONMENT=production + missing API key → MCP tools return explicit auth error
  • tests/api/test_auth.py extended or MCP tests verify refusal

Files / Modules Affected

mcp/server.js, api/deps.py, .env.example, mcp/Dockerfile


OSS Audit: Master Backlog v2

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions