Skip to content

fix(graphql): parameterize graphql_type_details type lookup#330

Open
CMLKevin wants to merge 1 commit into
cloudflare:mainfrom
CMLKevin:clawoss/fix/320-graphql-type-details-vars
Open

fix(graphql): parameterize graphql_type_details type lookup#330
CMLKevin wants to merge 1 commit into
cloudflare:mainfrom
CMLKevin:clawoss/fix/320-graphql-type-details-vars

Conversation

@CMLKevin
Copy link
Copy Markdown

@CMLKevin CMLKevin commented Mar 23, 2026

Summary

  • stop interpolating typeName directly into the graphql_type_details introspection query
  • send typeName through GraphQL variables using the existing query executor
  • add a regression test that proves malicious input stays in variables instead of altering the query document

Root Cause

fetchTypeDetails() built the __type(name: ...) query with string interpolation, so a crafted typeName could break out of the string literal and inject extra GraphQL syntax.

Testing

  • pnpm --filter graphql-mcp-server test
  • pnpm --filter graphql-mcp-server check:types
  • pnpm prettier apps/graphql/src/tools/graphql.tools.ts apps/graphql/src/tools/graphql.tools.test.ts apps/graphql/vitest.config.ts --check

Closes #320

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: GraphQL injection in fetchTypeDetails via string interpolation

1 participant