Skip to content

feat(clickhouse_driver): Set breadcrumbs in the streaming trace lifecycle - #7325

Merged
alexander-alderman-webb merged 14 commits into
masterfrom
webb/clickhouse_driver/breadcrumbs
Sep 3, 2026
Merged

feat(clickhouse_driver): Set breadcrumbs in the streaming trace lifecycle#7325
alexander-alderman-webb merged 14 commits into
masterfrom
webb/clickhouse_driver/breadcrumbs

rename tests

324db12
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Sep 1, 2026 in 0s

6 issues

High

Streaming ClickHouse breadcrumbs include query results when database query data is disabled - `sentry_sdk/integrations/clickhouse_driver.py:18`

In _wrap_end, the streaming breadcrumb always passes {"db.result": res, **breadcrumb_data}. This bypasses the preceding database_query_data/send_default_pii check, causing ClickHouse query results to be attached to breadcrumbs even when database query data collection is disabled. Pass only breadcrumb_data after the conditional merge.

Also found at:

  • sentry_sdk/integrations/clickhouse_driver.py:161-165
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:543-644
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:748-753
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:945-951
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:1345-1376
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:134-241
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:225-241
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:339-445
Streaming breadcrumbs always attach db.result, bypassing PII guards - `sentry_sdk/integrations/clickhouse_driver.py:161-165`

In _wrap_end, db.result is always merged into breadcrumb data even when the PII/database_query_data check fails; pass data=breadcrumb_data instead so results are only included when that guard succeeds.

Also found at:

  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:161-165
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:745-779
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:1148-1246
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:2053-2151
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:2349-2358
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:30
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:433-443
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:945-1043

Medium

ClickHouse breadcrumbs always include db.result despite PII/data-collection guards - `sentry_sdk/integrations/clickhouse_driver.py:150-165`

In the streaming breadcrumb path, db.result is unconditionally merged into breadcrumb data after the PII/data-collection check, so query results are always sent to Sentry. Gate the add_breadcrumb data the same way the non-streaming span path gates span.set_data("db.result", res).

Streaming breadcrumb tests never assert db.result absence - `sentry_sdk/integrations/clickhouse_driver.py:134-239`

Streaming breadcrumb cases rely on ApproxDict subset matching and omit explicit db.result checks, so they cannot catch the unconditional result leak; mirror the non-streaming tests’ absence assertions.

Also found at:

  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:24-31
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:770-819
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:1034-1037
  • tests/integrations/clickhouse_driver/test_clickhouse_driver.py:2145-2151
Streaming breadcrumb path never records db.params - `tests/integrations/clickhouse_driver/test_clickhouse_driver.py:547-552`

Unlike the non-streaming breadcrumb path, streaming never copies query/insert params into _breadcrumb_data, so even with database_query_data: True this test cannot observe db.params; collect params in the streaming start/send_data path when data collection is enabled.

Streaming ClickHouse breadcrumbs drop opted-in db.params - `tests/integrations/clickhouse_driver/test_clickhouse_driver.py:2273-2346`

When ClickHouse uses the streaming trace lifecycle, query breadcrumbs omit db.params even when database query data collection or send_default_pii is enabled. The non-streaming path records query and insert parameters in breadcrumbs, but the streaming path only records connection metadata, causing a loss of opted-in database observability data.

4 skills analyzed
Skill Findings Duration Cost
security-review 1 1m 4s $0.10
code-review 3 11m $3.31
find-bugs 2 21m 19s $3.81
skill-scanner 0 18m 55s $0.14

⏱ 52m 19s · 12.2M in / 517.9k out · $7.37