Skip to content

Commit 01fb6b8

Browse files
adinauerclaude
andcommitted
test(graphql): Cover malformed batched request body entries
Verify GraphQL request filtering fails closed when a batch contains a non-object entry. Refs #5666 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d0020cf commit 01fb6b8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎sentry/src/test/java/io/sentry/util/GraphqlUtilsTest.kt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ class GraphqlUtilsTest {
7373
}
7474
}
7575

76+
@Test
77+
fun `returns null for a batched GraphQL request body containing a non-object entry`() {
78+
val options = SentryOptions().also { it.dataCollection.graphql.setDocument(false) }
79+
80+
val result = GraphqlUtils.filterRequestBody("""[$REQUEST_BODY,"unexpected"]""", options)
81+
82+
assertThat(result).isNull()
83+
}
84+
7685
private companion object {
7786
const val REQUEST_BODY =
7887
"""{"operationName":"GetUser","variables":{"id":"123"},"query":"query { viewer { name } }"}"""

0 commit comments

Comments
 (0)