Skip to content

fix(core): [Remove sendDefaultPii 2] Omit empty cookie headers - #6799

Open
adinauer wants to merge 2 commits into
ref/remove-send-default-pii-v9from
fix/remove-send-default-pii-v9-empty-cookies
Open

adinauer wants to merge 2 commits into
ref/remove-send-default-pii-v9from
fix/remove-send-default-pii-v9-empty-cookies

Conversation

@adinauer

@adinauer adinauer commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Remove sendDefaultPii)


📜 Description

Return null when cookie-header filtering produces no values. Request integrations then omit the cookies field instead of serializing it as an empty string when a request has no cookie headers.

All current SDK callers already handle a nullable filtered result, so no integration-specific fallback is needed.

💡 Motivation and Context

The removal of sendDefaultPii makes cookie filtering run consistently across Servlet and Spring request integrations. For requests without cookie headers, the shared helper previously returned an empty list, which callers joined into Request.cookies = "".

Omitting the field accurately represents the absence of cookie data and avoids passing an empty collection into callers that expect either values or null.

💚 How did you test it?

  • Added tests for empty cookie-header lists and enumerations.
  • Ran focused core, Servlet, and Spring request integration tests.
  • Ran make format api.

📝 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

None.

⚠️ Merge this PR into #6793 using a merge commit (not squash). Then squash-merge #6793 into 9.x.x.

Return null when cookie-header filtering produces no values so request payloads omit the cookies field instead of serializing an empty string.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 589ca5e.

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

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

@sentry

sentry Bot commented Nov 27, 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: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 27, 2026
@adinauer
adinauer marked this pull request as ready for review November 27, 2026 12:29
@adinauer
adinauer requested a review from a team as a code owner November 27, 2026 12:29
@adinauer
adinauer requested review from 0xadam-brown and romtsn and removed request for a team November 27, 2026 12:29
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 27, 2026
}
}
return filteredHeaders;
return filteredHeaders.isEmpty() ? null : filteredHeaders;

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.

theoretically we could assign it to null and only initialize an ArrayList inside the for-loop in the first iteration. This would avoid unnecessary allocation and simplify this to just return filteredHeaders, but that's a micro-optimization so up to you :)

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: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants