Skip to content

DataCollection phase 2: migrate Sentry.AspNetCore #5430

Open

Description

@jamescrosswell

Part of #5420. Phase 2 — behavior-neutral consumer migration.

Migrate Sentry.AspNetCore to the resolved config:

  • src/Sentry.AspNetCore/ScopeExtensions.cs:40-52 — user factory gating → UserInfo.
  • :140-151 — cookie/header capture → Cookies / HttpHeaders.Request behaviors (shared filter utility).
  • :155-159 — REMOTE_ADDR client IP → UserInfo.
  • :136 — query string → UrlQueryParams behavior.
  • :170-186 + RequestBodyExtractionDispatcher — body capture → HttpBodies flag for whether; MaxRequestBodySize keeps governing size (integration option takes precedence).
  • src/Sentry.AspNetCore.Grpc/ProtobufRequestExtractionDispatcher.cs — same gating for protobuf bodies.
  • src/Sentry.OpenTelemetry/AspNetCoreEnricher.cs:11-20 — user factory gating → UserInfo.

Activity

  1. linear-code commented on Jul 22, 2026

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

    @jamescrosswell
    CollaboratorAuthor

    IncomingRequestBody falls back to true, not SendDefaultPii

    From reviewing #5885 (thanks @ric-oliv) — worth knowing before this issue is picked up.

    SendDefaultPii has never gated incoming request bodies. RequestBodyExtractionDispatcher.ExtractPayload switches on RequestSize alone and never reads it, and both call sites — Sentry.AspNetCore's ScopeExtensions.SetBody and AddAspNet's SystemWebRequestEventProcessor — invoke it unconditionally. So MaxRequestBodySize is the only gate today, which is what our docs say as well.

    DataCollectionResolver.IncomingRequestBody therefore falls back to true when DataCollection is unconfigured. Had it followed SendDefaultPii, this issue would have silently cost every app that set MaxRequestBodySize without SendDefaultPii its request bodies.

    The other three directions do fall back to SendDefaultPii:

    • OutgoingRequestBody and IncomingResponseBody — faithful, since SentryGraphQLHttpFailedRequestHandler gates sentryRequest.Data and responseContext.Data on it.
    • OutgoingResponseBody — no consumer today, so nothing to preserve; SendDefaultPii as the conservative default.

    So the intended wiring here stands as described: HttpBodies decides whether to collect, MaxRequestBodySize decides how much, and the size limit keeps taking precedence as an integration-level option.

  3. jamescrosswell commented on Nov 10, 2026

    @jamescrosswell
    CollaboratorAuthor

    Once #5894 merges there is one more cookie call site to move onto Cookies: SentryTracingMiddleware.TryStartTransaction sets the http.request.header.cookie span attribute from CookieFilter.FilterCookieHeaders, gated on SendDefaultPii.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions