feat(integrations): apply data_collection cookie filtering to wsgi, starlette, litestar, starlite#6797
feat(integrations): apply data_collection cookie filtering to wsgi, starlette, litestar, starlite#6797ericapisani wants to merge 8 commits into
Conversation
…tarlette, litestar, starlite Extends the granular cookie collection controls (data_collection.cookies) to _wsgi_common, starlette, litestar, and starlite, matching the behavior already used elsewhere. Falls back to should_send_default_pii() when data_collection is not configured for cookies. HTTP "Cookie" and "set-cookie" headers will continue to be completely filtered with the "[Filtered]" value. Fixes PY-2581 Fixes #6741
| request_info = event.get("request", {}) | ||
| if info: | ||
| if "cookies" in info and should_send_default_pii(): | ||
| if "cookies" in info: |
There was a problem hiding this comment.
the should_send_default_pii check here is no longer needed since this check happens within StarletteRequestExtractor
Codecov Results 📊✅ 89765 passed | ❌ 88 failed | ⏭️ 6213 skipped | Total: 96066 | Pass Rate: 93.44% | Execution Time: 312m 59s 📊 Comparison with Base Branch
➕ New Tests (88)View new tests
❌ Failed Tests
|
| File | Patch % | Lines |
|---|---|---|
| sentry_sdk/integrations/starlette.py | 90.00% | |
| sentry_sdk/integrations/litestar.py | 100.00% | |
| sentry_sdk/integrations/starlite.py | 100.00% |
Coverage diff
@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 89.74% 89.18% -0.56%
==========================================
Files 193 193 —
Lines 23995 24059 +64
Branches 8350 8398 +48
==========================================
+ Hits 21533 21455 -78
- Misses 2462 2604 +142
- Partials 1381 1375 -6Generated by Codecov Action
…de is off Previously the async request extractors attached an empty cookies dict when the data_collection cookies mode was off, while sync route handlers omitted it entirely. Make all integrations consistent by not attaching the cookies field at all when filtering yields no cookies.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 620e222. Configure here.
951c408 to
d717172
Compare
ec6f520 to
0396813
Compare
…tarlette, litestar, starlite Extends the granular cookie collection controls (data_collection.cookies) to _wsgi_common, starlette, litestar, and starlite, matching the behavior already used elsewhere. Falls back to should_send_default_pii() when data_collection is not configured for cookies. HTTP "Cookie" and "set-cookie" headers will continue to be completely filtered with the "[Filtered]" value. Fixes PY-2581 Fixes #6741
…de is off Previously the async request extractors attached an empty cookies dict when the data_collection cookies mode was off, while sync route handlers omitted it entirely. Make all integrations consistent by not attaching the cookies field at all when filtering yields no cookies.
0396813 to
326d796
Compare

Extends the granular cookie collection controls (data_collection.cookies)
to _wsgi_common, starlette, litestar, and starlite, matching the behavior
already used elsewhere. Falls back to should_send_default_pii() when
data_collection is not configured for cookies.
HTTP "Cookie" and "set-cookie" headers will continue to be completely filtered
with the "[Filtered]" value.
Fixes PY-2581
Fixes #6741