feat(integrations): apply data_collection cookie filtering to wsgi, starlette, litestar, starlite#6797
Open
ericapisani wants to merge 3 commits into
Open
feat(integrations): apply data_collection cookie filtering to wsgi, starlette, litestar, starlite#6797ericapisani wants to merge 3 commits into
ericapisani wants to merge 3 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
ericapisani
commented
Jul 10, 2026
| request_info = event.get("request", {}) | ||
| if info: | ||
| if "cookies" in info and should_send_default_pii(): | ||
| if "cookies" in info: |
Member
Author
There was a problem hiding this comment.
the should_send_default_pii check here is no longer needed since this check happens within StarletteRequestExtractor
Contributor
Codecov Results 📊✅ 91800 passed | ⏭️ 6302 skipped | Total: 98102 | Pass Rate: 93.58% | Execution Time: 315m 59s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 96.88%. Project has 2447 uncovered lines. Files with missing lines (3)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 89.76% 89.78% +0.02%
==========================================
Files 193 193 —
Lines 23888 23952 +64
Branches 8250 8298 +48
==========================================
+ Hits 21442 21505 +63
- Misses 2446 2447 +1
- Partials 1353 1355 +2Generated 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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