Skip to content

feat(wsgi): Gate client IP/user info behind data_collection config#6858

Open
ericapisani wants to merge 3 commits into
py-2586-gate-user-datafrom
py-2586-gate_user_data_wsgi
Open

feat(wsgi): Gate client IP/user info behind data_collection config#6858
ericapisani wants to merge 3 commits into
py-2586-gate-user-datafrom
py-2586-gate_user_data_wsgi

Conversation

@ericapisani

@ericapisani ericapisani commented Jul 21, 2026

Copy link
Copy Markdown
Member

Apply data_collection.user_info filtering to WSGI handling, mirroring the
ASGI change: gate REMOTE_ADDR capture, client.address/user.ip_address span
attributes, and event user.ip_address behind data_collection, falling back
to send_default_pii when data_collection is not configured.

Also skip installing the default EventScrubber when a data_collection
config is provided, since scrubbing could remove data that config allows,
and warn when an event scrubber is explicitly configured alongside it.

Add parametrized end-to-end tests for WSGI, Django, and Flask covering
data_collection precedence over send_default_pii.

Ref PY-2586
Ref #6746

Apply data_collection.user_info filtering to WSGI handling, mirroring the
ASGI change: gate REMOTE_ADDR capture, client.address/user.ip_address span
attributes, and event user.ip_address behind data_collection, falling back
to send_default_pii when data_collection is not configured.

Also skip installing the default EventScrubber when a data_collection
config is provided, since scrubbing could remove data that config allows,
and warn when an event scrubber is explicitly configured alongside it.

Add parametrized end-to-end tests for WSGI, Django, and Flask covering
data_collection precedence over send_default_pii.

Ref PY-2586
Ref #6746
@ericapisani
ericapisani requested a review from a team as a code owner July 21, 2026 16:11
@linear-code

linear-code Bot commented Jul 21, 2026

Copy link
Copy Markdown

PY-2586

@ericapisani ericapisani changed the title eat(wsgi): Gate client IP/user info behind data_collection config feat(wsgi): Gate client IP/user info behind data_collection config Jul 21, 2026
Comment thread sentry_sdk/client.py
Comment thread sentry_sdk/client.py Outdated
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

94900 passed | ⏭️ 6338 skipped | Total: 101238 | Pass Rate: 93.74% | Execution Time: 334m 33s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +2737
Passed Tests 📈 +2703
Failed Tests
Skipped Tests 📈 +34

All tests are passing successfully.

✅ Patch coverage is 92.00%. Project has 2508 uncovered lines.
❌ Project coverage is 89.65%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/client.py 50.00% ⚠️ 2 Missing and 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    89.70%    89.65%    -0.05%
==========================================
  Files          193       193         —
  Lines        24030     24242      +212
  Branches      8348      8528      +180
==========================================
+ Hits         21555     21734      +179
- Misses        2475      2508       +33
- Partials      1384      1394       +10

Generated by Codecov Action

Comment thread sentry_sdk/client.py

@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 and found 1 potential issue.

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 b49ba15. Configure here.

Comment thread .lore.md Outdated
Comment thread sentry_sdk/client.py
@ericapisani
ericapisani force-pushed the py-2586-gate_user_data_wsgi branch from b49ba15 to 18f8b31 Compare July 21, 2026 19:11
Comment thread sentry_sdk/client.py
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.

1 participant