Skip to content

Filter sensitive GraphQL variable values by name when variables are collected #5965

Closed as not planned

Description

@jamescrosswell

When GraphQL variables are collected, SentryGraphQLHttpFailedRequestHandler attaches them to Request.Data exactly as sent. A variable named password, token or apiKey reaches Sentry with its value.

The other key-value data DataCollection covers (headers, cookies, URL query params) goes through the sensitive denylist in SensitiveDataFilter: the key is kept and a matching value becomes [Filtered]. GraphQL variables are key-value data too, but DataCollection.GraphQL.Variables is all or nothing.

This isn't a regression. SendDefaultPii = true has always sent variables as-is, and #5934 keeps that. It came up as an optional suggestion in the automated review of #5934.

Before implementing

  • The Data Collection spec defines graphQL.variables as a Boolean, with no filtering by name. sentry-java's GraphqlUtils.filterRequestBody keeps or removes the whole variables member and doesn't scrub values. So this needs either a spec change (for example, letting variables take a KeyValueCollectionBehavior, as stackFrameVariables can since 0.9.0) or a decision to do it in .NET only.
  • Variables are arbitrary JSON. Decide whether nested keys are matched too, as in {"input": {"password": "..."}}.

Where

  • src/Sentry/GraphQLRequestContent.cs: FilterRequestContent already rewrites the body with Utf8JsonWriter, so filtering values could happen there.
  • src/Sentry/Internal/DataCollection/SensitiveDataFilter.cs: the denylist.

Related: #5420, #5432

Activity

  1. linear-code commented on Nov 18, 2026

    @linear-code
  2. jamescrosswell commented on Nov 18, 2026

    @jamescrosswell
    CollaboratorAuthor

    Not planned: we're matching sentry-java, which keeps or drops the whole variables member and doesn't filter values by name. #5934 already does this.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions