: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(replay_vision): keep personal data out of scanner reasoning output (#75169)
Kim Svatos Dugan7e90c639d660
diff --git a/products/replay_vision/backend/temporal/scanners/prompts/preamble.jinja b/products/replay_vision/backend/temporal/scanners/prompts/preamble.jinjaindex 26656133e59d..b882bba325a5 100644--- a/products/replay_vision/backend/temporal/scanners/prompts/preamble.jinja+++ b/products/replay_vision/backend/temporal/scanners/prompts/preamble.jinja@@ -8,6 +8,10 @@ The video plays at normal speed but at a low frame rate (about 3 frames per secoSession Replay hides privacy-sensitive content before it is recorded. Masked elements render as solid or diagonally-striped black/grey boxes; masked input text is replaced with asterisks (`*`) or similar filler characters. This is deliberate privacy masking configured by the customer — it is NOT a bug, missing content, a rendering glitch, a broken layout, or a failure to load. Never flag masked content as an issue, and never read meaning into the masked characters: the real value was visible to the user; you are only seeing the masked stand-in.</masking>+<output_privacy>+The video masks privacy-sensitive content, but the events tool and the navigation URLs can still expose real personal data in the clear: an email address or name in a search query or URL parameter, element text, an exception value, or session metadata. Never reproduce a person's personal data verbatim in any output field (`reasoning`, `summary`, tags, or any other text you write). This covers email addresses, full names, phone numbers, physical or IP addresses, payment or card details, government or account IDs, and precise location. Reason about such a value by describing it generically instead of quoting it: write "the user searched for an email address" or "entered their account email", never the literal address. You may still cite the moment and explain what happened; just keep the actual value out of your text.+</output_privacy>+<replay_artifacts>The replay reconstructs each page from DOM snapshots, so states the user never saw can appear on screen: validation or error text that ships hidden in the page's HTML can render visible, layouts can look broken or overlapping while the user saw a normal page, and hover-only UI may not replay. Before treating an on-screen error or warning as something the user experienced, corroborate it with the events: an input, click, or submit on the related element around that moment. Never infer user actions (typing into a field, submitting a form) from the mere presence of an error message. An error nobody interacted with is usually pre-rendered markup, not user-facing friction.</replay_artifacts>diff --git a/products/replay_vision/backend/tests/test_scanners.py b/products/replay_vision/backend/tests/test_scanners.pyindex 8502ca56e02c..a82c0f1a2961 100644--- a/products/replay_vision/backend/tests/test_scanners.py+++ b/products/replay_vision/backend/tests/test_scanners.py@@ -85,6 +85,14 @@ class TestPreamble:assert "asterisks" in renderedassert "not a bug" in rendered.lower()+ def test_preamble_forbids_reproducing_personal_data_verbatim(self) -> None:+ # Masking hides PII in the video, but the events tool / navigation URLs can expose it in the clear;+ # the model must reason about such values generically, never echo them into its output.+ rendered = scanner_from_db(_build_replay_scanner()).preamble(team_name="Acme")+ assert "<output_privacy>" in rendered+ assert "email address" in rendered+ assert "verbatim" in rendered+def test_preamble_exposes_events_via_tool_not_inline(self) -> None:scanner = scanner_from_db(_build_replay_scanner())rendered = scanner.preamble(team_name="Acme")