Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

🔒️(summary) sanitize analytics client failures

Florent Chehab72af9d629e45
diff --git a/src/summary/summary/core/analytics.py b/src/summary/summary/core/analytics.py
index 852ede26..287fcafe 100644
--- a/src/summary/summary/core/analytics.py
+++ b/src/summary/summary/core/analytics.py
@@ -54,8 +54,8 @@ class Analytics:
self._client.capture(
event_name, distinct_id=distinct_id, properties=properties
)
- except Exception as e:
- raise AnalyticsException("Failed to capture analytics event") from e
+ except Exception:
+ raise AnalyticsException("Failed to capture analytics event") from None
def is_feature_enabled(self, feature_name: str, distinct_id: str = None) -> bool:
"""Check if a feature flag is enabled for a user."""
@@ -64,8 +64,8 @@ class Analytics:
try:
return self._client.feature_enabled(feature_name, distinct_id)
- except Exception as e:
- logger.error("Error checking feature flag %s: %s", feature_name, e)
+ except Exception:
+ logger.error("Error checking feature flag %s", feature_name)
return False
diff --git a/src/summary/tests/unit/test_privacy.py b/src/summary/tests/unit/test_privacy.py
index 8f5a0a0b..6699ad51 100644
--- a/src/summary/tests/unit/test_privacy.py
+++ b/src/summary/tests/unit/test_privacy.py
@@ -79,6 +79,17 @@ def test_webhook_failure_keeps_retry_category(monkeypatch, settings_override):
assert exc.value.__suppress_context__
+def test_analytics_failure_does_not_chain_payload(monkeypatch):
+ """Analytics errors do not expose arbitrary client exception text."""
+ client = analytics.Analytics()
+ client._client = Mock()
+ client._client.capture.side_effect = ValueError(CANARY)
+ with pytest.raises(analytics.AnalyticsException) as exc:
+ client.capture("event", "user")
+ assert CANARY not in str(exc.value)
+ assert exc.value.__suppress_context__
+
+
def test_analytics_source_url_removes_signature():
"""Task analytics keeps the source path without credentials or signature."""
from datetime import datetime, timezone # noqa: PLC0415