Skip to content

ref(core)!: [Remove sendDefaultPii 1] Remove sendDefaultPii - #6793

Open
adinauer wants to merge 4 commits into
9.x.xfrom
ref/remove-send-default-pii-v9
Open

adinauer wants to merge 4 commits into
9.x.xfrom
ref/remove-send-default-pii-v9

Conversation

@adinauer

@adinauer adinauer commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Remove sendDefaultPii)


📜 Description

Remove the deprecated sendDefaultPii option from the Java, Android, Spring, external configuration, and generated API surfaces. Data Collection is now the only SDK-level control for automatically collected data.

When Data Collection is not explicitly configured, the documented defaults now apply directly: user information, database query data, file paths, GraphQL content, and HTTP bodies are enabled, while cookies, URL query parameters, and HTTP headers use their default deny lists. Explicit Data Collection settings continue to take precedence.

This also removes the compatibility-only DataCollection.forceDataCollection() API, makes Logback rely only on includeUnencodedMessage, and applies the request-header Data Collection policy to OpenTelemetry-derived headers.

💡 Motivation and Context

sendDefaultPii was deprecated in 8.x after Data Collection shipped. Version 9 removes the legacy configuration surfaces and fallback behavior so integrations use one consistent policy model.

Migration guidance documents the new defaults and how to configure restrictive collection behavior explicitly.

💚 How did you test it?

  • Ran affected core, Android, Apollo, GraphQL, Ktor, Logback, OkHttp, OpenTelemetry, Servlet, Spring, and Spring Boot tests.
  • Ran make format api.
  • Ran Spotless and Detekt checks.
  • Verified no active legacy option or compatibility-path references remain.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

  • Update the v9 Java and Android option documentation in sentry-docs.
  • Audit downstream wrappers that still expose sendDefaultPii.

⚠️ Merge #6799 into this branch with a merge commit before squash-merging this PR into 9.x.x.

@linear-code

linear-code Bot commented Nov 26, 2026

Copy link
Copy Markdown

JAVA-744

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: high

For commit c642802.

Main concerns: public contract, reach, data sent to Sentry.

Rules that block low also fired:

  • R1: code was truncated, omitted or a reduced context was used: sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApollo5HttpInterceptor.kt, sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApollo5Interceptor.kt, sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsClientErrorsTest.kt, sentry-apollo/src/main/java/io/sentry/apollo/SentryApolloInterceptor.kt, sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java and 101 more
  • R4: a public API record changed: sentry-spring-7/api/sentry-spring-7.api, sentry-spring-jakarta/api/sentry-spring-jakarta.api, sentry-spring/api/sentry-spring.api, sentry/api/sentry.api

This label is a hint for reviewers, not an approval.

@sentry

sentry Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.66.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high labels Nov 26, 2026
@adinauer
adinauer marked this pull request as ready for review November 27, 2026 03:56
@adinauer
adinauer requested a review from a team as a code owner November 27, 2026 03:56
@adinauer
adinauer requested review from 0xadam-brown and romtsn and removed request for a team November 27, 2026 03:56
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high labels Nov 27, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

httpRequest.getHeaders(CookieUtils.COOKIE_HEADER_NAME),
options.getDataCollectionResolver().getCookies(),
Collections.emptyList());
sentryRequest.setCookies(cookies == null ? null : String.join(",", cookies));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Servlet cookies skip the configured session cookie name

Medium Severity

The servlet processors now attach Cookie values by default, but they pass Collections.emptyList() as the extra sensitive cookie names. The container's configured session cookie name (from SessionCookieConfig) is never masked. A custom session cookie like MYAPPSESS doesn't match the built-in security list or the sensitive terms, so its session token goes to Sentry in plain text.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b6c577c. Configure here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds valid?

Remove the deprecated option and use Data Collection defaults across SDK integrations. Document how to configure restrictive collection behavior when migrating to version 9.

Fixes GH-6160
New JDK trust stores reject the compromised eMudhra certificate during the TLS handshake before the SDK-specific check runs. Assert the shared IOException contract so the transport test remains valid across JDK trust store versions.
@adinauer
adinauer force-pushed the ref/remove-send-default-pii-v9 branch from b6c577c to c642802 Compare November 27, 2026 10:24
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high labels Nov 27, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c642802. Configure here.

httpRequest.getHeaders(CookieUtils.COOKIE_HEADER_NAME),
options.getDataCollectionResolver().getCookies(),
Collections.emptyList());
sentryRequest.setCookies(cookies == null ? null : String.join(",", cookies));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Servlet requests without cookies report an empty string

Low Severity

HttpServletRequest.getHeaders("Cookie") returns an empty enumeration when the request has no cookies, not null. filterCookiesFromHeader then returns an empty list, and String.join turns it into "". So every event from a request without cookies now gets request.cookies = "" instead of leaving the field unset.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c642802. Configure here.

@adinauer adinauer changed the title ref(core)!: Remove sendDefaultPii ref(core)!: [Remove sendDefaultPii 1] Remove sendDefaultPii Nov 27, 2026
if (scopes.getOptions().getDataCollectionResolver().isDataCollectionConfigured()) {
urlDetails.applyToSpan(span);
}
urlDetails.applyToSpan(span);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now attaches the raw URL fragment to the span by default. For example, #access_token=example is sent unchanged, even when urlQueryParams is off. Can we apply the policy in UrlUtils.parse so both Spring variants get the fix? That's how it's mentioned in the spec as well: https://develop.sentry.dev/sdk/foundations/client/data-collection/#urls

}
});
return headers;
return HttpUtils.filterHeaders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this now will always capture cookies that are explicitly allowed in OTel (like OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS=cookie) as [Filtered] -- is this intentional?

@romtsn romtsn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd check the bugbot finding and also the couple of comments I've left, let me know when it needs another look!

This branch has not been deployed

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

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants