Skip to content

Add config option to disable GraphQL introspection for unauthenticated requests #5635

Description

@syphernl

Feature request

MAS exposes a GraphQL endpoint at /graphql which is used by the self-service account UI.

This endpoint allows unauthenticated clients to run introspection queries:

curl -X POST https://auth.matrix.example.com/graphql -H "Content-Type: application/json" -d '{"query":"{ __schema { types { name } } }"}'

This returns the full schema (129 types) without any authentication. While actual data queries correctly return viewer: Anonymous for unauthenticated requests, the schema itself is fully discoverable.

Request

Add a configuration option to disable GraphQL introspection for unauthenticated (anonymous) requests, similar to how playground: false disables the playground UI.

For example:

http:
  listeners:
    - name: graphql
      playground: false
      introspection: authenticated_only  # or: false / public / authenticated_only

Context

  • The schema is already publicly documented, so this is a defence-in-depth measure
  • The playground option already exists as precedent for this kind of configuration
  • The self-service UI does not require introspection for anonymous users; it only needs it after the user has authenticated via session cookie
  • Operators deploying MAS in regulated environments (healthcare, government) may have privacy requirements that prohibit exposing API schemas without authentication

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions