Skip to content

ref(integrations): Drop legacy send_default_pii header filtering in _filter_headers - #7737

Merged
ericapisani merged 5 commits into
major/3.0from
py-2853-update-filter-headers-helper
Sep 29, 2026
Merged

ericapisani merged 5 commits into
major/3.0from
py-2853-update-filter-headers-helper

Conversation

@ericapisani

Copy link
Copy Markdown
Member

_filter_headers now always uses the data_collection configuration for request header filtering, removing the legacy send_default_pii fallback path and the now-unused use_annotated_value parameter. Updates all call sites across aiohttp, aws_lambda, chalice, gcp, quart, sanic, tornado, wsgi, and _asgi_common accordingly, and removes tests covering the removed legacy behaviour.

Refs PY-2853
Refs #7646

…filter_headers

_filter_headers now always uses the data_collection configuration for
request header filtering, removing the legacy send_default_pii fallback
path and the now-unused use_annotated_value parameter. Updates all call
sites across aiohttp, aws_lambda, chalice, gcp, quart, sanic, tornado,
wsgi, and _asgi_common accordingly, and removes tests covering the
removed legacy behaviour.

Refs PY-2853
Refs #7646
@ericapisani
ericapisani requested a review from a team as a code owner September 28, 2026 18:55
@linear-code

linear-code Bot commented Sep 28, 2026

Copy link
Copy Markdown

PY-2853

@ericapisani
ericapisani marked this pull request as draft September 28, 2026 18:59
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ 57592 passed | ❌ 1 failed | ⏭️ 2729 skipped | Total: 60322 | Pass Rate: 95.47% | Execution Time: 166m 42s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -76537
Passed Tests 📉 -72098
Failed Tests 📈 +1
Skipped Tests 📉 -4440

➕ New Tests (1)

View new tests
  • test_input_attributes_nonstreaming_chat[messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
    • Status: ❌ Failing

❌ Failed Tests

test_input_attributes_nonstreaming_chat[messages0-expected_system_instructions0-expected_input_messages0]

File: tests.integrations.mistral.test_mistral
Suite: py3.10-mistral-v2.6.0
Error: KeyError: 139871916191744

Stack Trace
tests/integrations/mistral/test_mistral.py:389: in test_input_attributes_nonstreaming_chat
    sentry_init(
tests/conftest.py:349: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:278: in __init__
    self._init_impl()
sentry_sdk/client.py:428: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:217: in setup_integrations
    for integration_cls in iter_default_integrations(
sentry_sdk/integrations/__init__.py:44: in iter_default_integrations
    yield getattr(import_module(module), cls)
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1024: in _find_and_load
    ???
<frozen importlib._bootstrap>:171: in __enter__
    ???
<frozen importlib._bootstrap>:123: in acquire
    ???
E   KeyError: 139871916191744

✅ Patch coverage is 86.67%. Project has 2060 uncovered lines.
❌ Project coverage is 90.1%. Comparing base (9d1c31d) to head (27ed26e).

Files with missing lines (3)
File Patch % Lines
sentry_sdk/integrations/aws_lambda.py 0.00% ⚠️ 1 Missing
sentry_sdk/integrations/chalice.py 100.00% ⚠️ 1 partials
sentry_sdk/integrations/gcp.py 0.00% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
- Coverage    90.28%    90.10%    -0.18%
==========================================
  Files          195       179       -16
  Lines        26195     20804     -5391
  Branches      9758      7318     -2440
==========================================
+ Hits         23649     18744     -4905
- Misses        2546      2060      -486
- Partials      1483      1219      -264

Generated by Codecov Action

… defaults

_filter_headers now always routes through the data_collection config, so
the default denylist terms ("forwarded", "-ip", "remote-", "via", "-user")
apply even when data_collection isn't explicitly configured. Update
tests/integrations/asgi/test_asgi.py::test_capture_transaction and
tests/integrations/aws_lambda/test_aws_lambda.py::test_non_dict_event to
expect the now-filtered remote-addr and X-Forwarded-Proto headers.
@ericapisani
ericapisani marked this pull request as ready for review September 29, 2026 12:36
@ericapisani
ericapisani merged commit 0d73f7a into major/3.0 Sep 29, 2026
145 of 147 checks passed
@ericapisani
ericapisani deleted the py-2853-update-filter-headers-helper branch September 29, 2026 14:14
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