feat(anthropic): Gate prompt collection on data_collection option - #7054
1 issue
security-review: Found 1 issue (1 medium)
Medium
Anthropic response text/tool calls ignore data_collection gen_ai.outputs opt-out - `sentry_sdk/integrations/anthropic.py:487`
This change gates prompt (input) collection on data_collection["gen_ai"]["inputs"], but _set_output_data (line 609) still records GEN_AI_RESPONSE_TEXT and GEN_AI_RESPONSE_TOOL_CALLS based solely on the legacy should_send_default_pii() and integration.include_prompts check, so a user who sets _experiments={"data_collection": {"gen_ai": {"outputs": False}}} while still having send_default_pii=True will keep sending LLM response content — which frequently echoes user PII — to Sentry despite the explicit opt-out and despite the SDK warning that send_default_pii "is ignored when data_collection is set".
⏱ 6m 29s · 235.7k in / 11.9k out · $0.40
Annotations
Check warning on line 487 in sentry_sdk/integrations/anthropic.py
sentry-warden / warden: security-review
Anthropic response text/tool calls ignore data_collection gen_ai.outputs opt-out
This change gates prompt (input) collection on `data_collection["gen_ai"]["inputs"]`, but `_set_output_data` (line 609) still records `GEN_AI_RESPONSE_TEXT` and `GEN_AI_RESPONSE_TOOL_CALLS` based solely on the legacy `should_send_default_pii() and integration.include_prompts` check, so a user who sets `_experiments={"data_collection": {"gen_ai": {"outputs": False}}}` while still having `send_default_pii=True` will keep sending LLM response content — which frequently echoes user PII — to Sentry despite the explicit opt-out and despite the SDK warning that `send_default_pii` "is ignored when `data_collection` is set".