You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GraphQLPostInvocationInputParser may distort query string read from HttpServletRequest #385
GraphQLPostInvocationInputParser uses request.getReader().lines().collect(joining()) to read the query string from the request. This effectively removes all line breaks from the request body.
But the query might have used these line breaks as token separator, therefore the resulting query may become invalid.
Example: Given a request body of
{
hero {
name
weight
} }
this will result in a query string {hero {nameweight}} and fail since there is no such attribute.
I would suggest to use request.getReader().lines().collect(joining(" ")) to read the request body, therefore replacing line breaks with a space.
Good catch. Apparently nobody ever encountered this since most people apply proper indentation in the GraphQL queries which causes nobody to actually run into this bug in reality. I've added a fix as proposed.
Activity
fix: support poorly formatted graphql queries fixes #385
oliemansm commentedon Jan 23, 2022
Good catch. Apparently nobody ever encountered this since most people apply proper indentation in the GraphQL queries which causes nobody to actually run into this bug in reality. I've added a fix as proposed.