fix: GraphQL depth-limit probe uses real schema fields instead of guessed names#76
Merged
GovindarajanL merged 1 commit intoJul 25, 2026
Conversation
…ssed names
The query-depth-limit check sent a hardcoded deeply-nested query built
from placeholder field names ("a", "b", "c", ...). Every real GraphQL
schema rejects that at schema validation (HTTP 400 "Cannot query field")
before depth is ever assessed, so the check could never produce a true
positive against any real target.
Reproduced against DVGA: no depth-limit finding was ever produced, and
replaying the exact probe payload by hand confirmed the 400.
Rebuilds the probe from __Type.ofType, a self-referencing field mandated
by the GraphQL introspection spec on every compliant server, so it
reaches real depth resolution instead of failing validation. Also fixes
a latent sibling bug in the introspection check, which accepted any 2xx
response containing the substring "__schema" -- a disabled-introspection
error message ("Cannot query field \"__schema\"...") matches that same
substring. Now requires a real "data" body with no "errors".
Fixes OWASP#71
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #71
Summary
The query-depth-limit check sent a hardcoded deeply-nested query built from placeholder field names (
a,b,c, ...). Every real GraphQL schema rejects that at schema validation (HTTP 400 "Cannot query field") before depth is ever assessed, so the check could never produce a true positive against any real target.Reproduction
Scanned DVGA. Introspection and batch-query-abuse were correctly detected, but no depth-limit finding was ever produced. Replaying the exact probe by hand:
Fix
Rebuilds the probe from
__Type.ofType, a self-referencing field mandated by the GraphQL introspection spec on every compliant server, so it reaches real depth resolution instead of failing validation.Also fixes a latent sibling bug in the introspection check: it accepted any 2xx response containing the substring
"__schema", but a disabled-introspection error message (Cannot query field "__schema"...) matches that same substring, which would have caused a false "introspection enabled" finding. Now requires a real"data"body with no"errors".Verification
"GraphQL Query Depth Limit Not Enforced"(MEDIUM) now fires correctly. Manually replayed the new probe and confirmed a genuine"data"response with no"errors".ofTypechaining (not guessed names) via anArgumentCaptor, and the introspection check asserted to not false-positive on an error message that mentions__schema.Test plan
mvn testpasses