Skip to content

feat(core): Data Collection - #5759

Draft
adinauer wants to merge 288 commits into
mainfrom
feat/data-collection
Draft

adinauer wants to merge 288 commits into
mainfrom
feat/data-collection

Conversation

@adinauer

@adinauer adinauer commented Jul 14, 2026

Copy link
Copy Markdown
Member

PR Stack (Data Collection)


📜 Description

Collection PR for the Data Collection stack. The individual PRs add the configuration model, resolution and compatibility bridge, external configuration, filtering, and integration enforcement.

Squash-merge this PR into main only after every stack PR has been merged into this branch using merge commits.

💡 Motivation and Context

Introduce the specification-defined dataCollection configuration while preserving existing sendDefaultPii behavior for users who do not opt into the new namespace.

Refs #5666

💚 How did you test it?

This collection branch contains only an empty commit. Each stack PR carries its own tests.

📝 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.

🔮 Next steps

Merge the Data Collection stack into this branch in order, then squash-merge this PR into main.

#skip-changelog

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against cffc94b

@sentry

sentry Bot commented Jul 14, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

…fo-options

fix(android): [Data Collection 15] Scope device info cache to SDK options
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

…replay-network-options

test(replay): [Data Collection 16] Keep Replay independent
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

1 similar comment
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

adinauer and others added 9 commits September 8, 2026 11:23
…nding

fix(spring): [Data Collection 18] Bind key-value policies
…installation-id

fix(android): [Data Collection 19] Preserve installation ID
…-description

fix(ktor): [Data Collection 20] Exclude query parameters from span descriptions
…-options

feat(core): [Data Collection 21] Add external configuration
…manifest

feat(android): [Data Collection 22] Add manifest configuration
…-urls

fix(core): [Data Collection 23] Support WebSocket URL parsing
…tches

fix(core): [Data Collection 24] Narrow utility exception handling
Describe Data Collection defaults, migration from sendDefaultPii, and the supported configuration mechanisms. Include examples for key-value filtering and HTTP body selection so users can adopt the new controls safely.

Refs #5666

Co-Authored-By: Claude <noreply@anthropic.com>
Add the specification-defined filePaths option across programmatic, external, Spring Boot, and Android manifest configuration. Gate automatically captured File I/O paths through the resolved policy while preserving sendDefaultPii when Data Collection is absent.\n\nRefs #5666
Allow encoder-equipped Logback appenders to include original message
templates and parameters without relying on sendDefaultPii.

Keep sendDefaultPii as a temporary compatibility exception while Data
Collection replaces its other behavior.

Co-Authored-By: Claude <noreply@anthropic.com>
Comment thread sentry/api/sentry.api
adinauer and others added 5 commits September 10, 2026 06:19
feat(core): [Data Collection 25] Apply file path policy
Describe how encoder use, the integration opt-in, and the legacy PII option control original message data.

Refs #5666

Co-Authored-By: Claude <noreply@anthropic.com>
Align the includeUnencodedMessage getter and setter names so Kotlin exposes the option as a mutable synthetic property.

Refs #5666

Co-Authored-By: Claude <noreply@anthropic.com>
…unencoded-message

feat(logback): [Data Collection 26] Add unencoded message opt-in
Align nullable Boolean getters and setters so Kotlin exposes mutable synthetic properties. Allow callers to clear an explicit override by assigning null.

Co-Authored-By: Claude <noreply@anthropic.com>
Stop treating DataCollection construction as an implicit opt-in. Add an explicit forceDataCollection method so callers can select the new defaults without replacing manifest or external configuration.

Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md
#	sentry/api/sentry.api
…opt-in

fix(core): [Data Collection 27] Make opt-in explicit
Comment on lines +100 to 125
public static @NotNull Map<String, String> filterHeaders(
final @NotNull Map<String, String> headers,
final @NotNull KeyValueCollectionBehavior behavior) {
final @NotNull Map<String, String> filteredHeaders = new LinkedHashMap<>();
if (behavior.getMode() == KeyValueCollectionBehavior.Mode.OFF) {
return filteredHeaders;
}

final @NotNull ArrayList<String> filteredHeaders = new ArrayList<>();

for (final String header : headers) {
filteredHeaders.add(
HttpUtils.filterOutSecurityCookies(header, additionalCookieNamesToFilter));
for (final Map.Entry<String, String> header : headers.entrySet()) {
final @NotNull String name = header.getKey();
final boolean sensitive =
containsTerm(name, SENSITIVE_DATA_KEYS)
|| "Cookie".equalsIgnoreCase(name)
|| "Set-Cookie".equalsIgnoreCase(name);
if (sensitive) {
filteredHeaders.put(name, SENSITIVE_DATA_SUBSTITUTE);
} else {
final boolean matchesTerm = containsTerm(name, behavior.getTerms());
final boolean shouldFilter =
behavior.getMode() == KeyValueCollectionBehavior.Mode.DENY_LIST
? matchesTerm
: !matchesTerm;
filteredHeaders.put(name, shouldFilter ? SENSITIVE_DATA_SUBSTITUTE : header.getValue());
}
}

return filteredHeaders;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

filterHeaders drops IP/proxy sensitive-header denylist

When Data Collection is enabled, filterHeaders no longer treats X-Forwarded-For, X-Real-IP, Remote-Addr, and Forwarded as always-sensitive, so client IP/proxy chain values can be sent to Sentry under the default deny-list. Reuse containsSensitiveHeader (or equivalent) in the always-sensitive check.

Evidence
  • filterHeaders() only hard-redacts names matching SENSITIVE_DATA_KEYS or exact Cookie/Set-Cookie; it never consults SENSITIVE_HEADERS/containsSensitiveHeader().
  • SENSITIVE_HEADERS still includes X-FORWARDED-FOR, X-REAL-IP, REMOTE-ADDR, and FORWARDED, and none of those names contain a SENSITIVE_DATA_KEYS term such as auth, token, or session.
  • Call sites switch to this path whenever Data Collection is configured (for example SentryRequestResolver.resolveHeadersMap() and SentryOkHttpUtils.getRequestHeaders()), using the default empty deny-list from DataCollectionResolver.getHttpRequestHeaders().
  • Result: those IP/proxy headers are collected with plaintext values instead of being omitted or replaced with [Filtered].

Identified by Warden · security-review · GSK-27Q

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants