Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(error-tracking): stop sending frame locals with captured exceptions (#108158)

Aleksander Błaszkiewicz6d30d7b8bb78
diff --git a/posthog/apps.py b/posthog/apps.py
index 349bb09bc500..fb2087191ce9 100644
--- a/posthog/apps.py
+++ b/posthog/apps.py
@@ -16,7 +16,6 @@ from posthog.utils import (
get_instance_region,
get_machine_id,
initialize_self_capture_api_token,
- str_to_bool,
)
logger = structlog.get_logger(__name__)
@@ -89,10 +88,8 @@ class PostHogConfig(AppConfig):
"environment": os.getenv("OTEL_SERVICE_ENVIRONMENT"),
}
- if str_to_bool(os.environ.get("TEMPORAL_DISABLE_EXCEPTION_VARIABLE_CAPTURE", "false")):
- posthoganalytics.capture_exception_code_variables = False
- else:
- posthoganalytics.capture_exception_code_variables = True # ty: ignore[invalid-assignment]
+ # Frame locals can hold credentials that the SDK masking does not reliably redact, so never send them.
+ posthoganalytics.capture_exception_code_variables = False
if settings.E2E_TESTING:
posthoganalytics.api_key = "phc_ex7Mnvi4DqeB6xSQoXU1UVPzAmUIpiciRKQQXGGTYQO" # ty: ignore[invalid-assignment]