Skip to content

[SECURITY] Fail startup when MCP security configuration cannot be parsed #824

Closed

Description

@jeffreyaven

Constituent of #769. Reviewed current main at 1de4135 on 2026-10-08; this issue proposes work, no implementation is included.

CWEs: CWE-20.

Finding and evidence

internal/stackql/cmd/mcp.go discards the error from json.Unmarshal. A zero or partially populated configuration then proceeds to server construction.

Current-code test: {"server":{"mode":"read_only","request_timeout":123}} produces a type error, leaves the effective mode as safe, and passes Config.Validate. A built-binary stdio launch with this malformed configuration started and exited normally on EOF instead of rejecting it. Invalid JSON can also discard an enabled_tools restriction, reverting to the default set.

The flag description says a YAML/JSON file path, while this command parses an inline JSON string. providerRegistryIdentifier also suppresses YAML errors, but that display helper alone is not an authorization bypass.

Required outcome

  • Propagate decoding/validation errors and exit nonzero before opening a listener or exposing tools. Never continue with partial security settings.
  • Establish one documented input contract (inline JSON, or explicit file loading with the correct parser), and use it consistently across mcp/srv MCP entrypoints.
  • Test legacy read_only mapping and unknown fields/invalid values so a typo cannot silently broaden access.

Validation and acceptance

Add startup/robot tests for malformed JSON, wrong types, invalid mode, bad duration, incorrect enabled_tools shape and unsupported file-path input. Assert no listener/tools become available; valid read_only and tool restrictions must remain effective. Error output must not echo secret configuration values.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions