Skip to content

Detect introspection fields instead of keyword substrings - #323

Open
theman6660 wants to merge 1 commit into
KLR-Pattern:masterfrom
theman6660:fix/introspection-field-detection
Open

theman6660 wants to merge 1 commit into
KLR-Pattern:masterfrom
theman6660:fix/introspection-field-detection

Conversation

@theman6660

Copy link
Copy Markdown
Contributor

A normal business query such as { EchoEntity { echo(text: "__schema") { text } } } is dispatched as introspection instead of invoking echo. String arguments containing __type or __typename similarly produce an empty metadata response. The compose MCP detector also incorrectly rejects these strings.

Use a shared GraphQL AST field visitor for both detection paths. Only actual field names trigger introspection; strings, block strings, comments, aliases, variable names, and operation names do not. Keep the cheap negative keyword check and let malformed documents reach the normal query parser.

The tests include actual GraphQLHandler.execute calls, field aliases, fragments, string literals, and malformed input. Before the fix, 13 new cases failed and 6 controls passed; all 19 now pass. With existing compose introspection tests, 52 passed. Full tests excluding the independently confirmed environment-incompatible memory test: 916 passed, 1 skipped, 1 deselected. Ruff and git diff --check passed.

Prepared with OpenAI Codex assistance. No production usage, human review or upstream CI is claimed.

This branch has not been deployed

No deployments
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.

1 participant