feat: add access control to heatmaps
Problem
Heatmaps are commonly used by platform addon subscribers, but it does not have access control.
Changes
Add access control to heatmaps, including the backend viewsets and frontend routes + resources.
How did you test this code?
Tests + manually
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Automatic notifications
- [ ] Publish to changelog?
- [ ] Alert Sales and Marketing teams?
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted) - or - Fully autonomous
🤖 CI report
⚠️ Bundle size — 🔺 +900 B (+0.0%)
Uncompressed size of every built .js bundle, compared against the base branch.
Total: 64.82 MiB · 🔺 +900 B (+0.0%)
No file changed by more than 1000 B.
Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report
✅ Eager graph — within budget
How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.
| Root | Eager (shipped) | Δ vs base | Budget |
|---|---|---|---|
entry (logged-out pages, app bootstrap)src/index.tsx |
1.22 MiB · 22 files | no change | ███░░░░░░░ 28.4% of 4.29 MiB |
authenticated shell (every logged-in page)src/scenes/AuthenticatedShell.tsx |
8.14 MiB · 2,987 files | 🔺 +96 B (+0.0%) | █████████░ 88.0% of 9.25 MiB |
🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
Largest files eagerly shipped from src/index.tsx
| Size | File |
|---|---|
| 126.8 KiB | ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.production.min.js |
| 24.6 KiB | ../node_modules/.pnpm/[email protected]/node_modules/buffer/index.js |
| 6.3 KiB | ../node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.production.min.js |
| 4.5 KiB | ../node_modules/.pnpm/@[email protected]/node_modules/@jspm/core/nodelibs/browser/process.js |
| 3.9 KiB | ../node_modules/.pnpm/[email protected]/node_modules/scheduler/cjs/scheduler.production.min.js |
| 1.4 KiB | ../node_modules/.pnpm/[email protected]/node_modules/base64-js/index.js |
| 1.3 KiB | src/RootErrorBoundary.tsx |
| 912 B | ../node_modules/.pnpm/[email protected]/node_modules/ieee754/index.js |
| 789 B | src/scenes/ChunkLoadErrorBoundary.tsx |
| 762 B | src/index.tsx |
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
| Size | File |
|---|---|
| 281.3 KiB | ../node_modules/.pnpm/[email protected]/node_modules/posthog-js/dist/rrweb.js |
| 267.7 KiB | ../node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 235.5 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 222.9 KiB | ../node_modules/.pnpm/[email protected]/node_modules/posthog-js/dist/module.js |
| 164.0 KiB | src/queries/validators.js |
| 154.3 KiB | ../node_modules/.pnpm/[email protected]/node_modules/re2js/build/index.esm.js |
| 126.8 KiB | ../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.8 KiB | src/lib/api.ts |
| 93.3 KiB | ../node_modules/.pnpm/[email protected]/node_modules/prosemirror-view/dist/index.js |
| 92.7 KiB | ../packages/quill/packages/quill/dist/index.js |
Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479
✅ Dist folder size — 🔺 +837.9 KiB (+0.1%)
Total size of the built frontend/dist folder (all assets), compared against the base branch.
Total: 1327.22 MiB · 🔺 +837.9 KiB (+0.1%)
⚠️ Backend coverage — 95.0% of changed backend lines covered — 11 uncovered
🧪 Backend test coverage
Patch coverage — changed backend lines (products + core): ███████████████████░ 95.0% (238 / 249)
| File | Patch | Uncovered changed lines |
|---|---|---|
products/web_analytics/backend/api/heatmaps_api.py |
88.6% | 201, 337, 339, 464, 470, 477–478, 991 |
products/web_analytics/backend/test/test_heatmap_access_control.py |
98.3% | 23–24, 109 |
🤖 Agents: add a test covering the lines above, or note why under "How did you test this code?". Machine-readable gap list: the patch-coverage artifact on this run (gh run download 29525884251 -n patch-coverage), or the coverage-data block at the end of this comment.
Per-product line coverage (touched products)
| Product | Coverage | Lines |
|---|---|---|
platform_features |
██░░░░░░░░░░░░░░░░░░ 12.1% |
7 / 58 |
batch_exports |
████████░░░░░░░░░░░░ 39.6% |
8,414 / 21,225 |
demo |
███████████░░░░░░░░░ 56.2% |
1,497 / 2,663 |
warehouse_sources_queue |
████████████░░░░░░░░ 59.2% |
148 / 250 |
tasks |
█████████████░░░░░░░ 67.0% |
25,838 / 38,560 |
data_tools |
██████████████░░░░░░ 70.0% |
63 / 90 |
ai_gateway |
███████████████░░░░░ 75.0% |
9 / 12 |
signals |
████████████████░░░░ 79.1% |
19,031 / 24,073 |
data_modeling |
████████████████░░░░ 80.0% |
4,834 / 6,045 |
cdp |
████████████████░░░░ 80.7% |
3,118 / 3,864 |
wizard |
████████████████░░░░ 82.5% |
772 / 936 |
agent_platform |
█████████████████░░░ 84.7% |
3,273 / 3,862 |
notebooks |
█████████████████░░░ 84.8% |
6,903 / 8,141 |
cohorts |
█████████████████░░░ 86.1% |
4,022 / 4,671 |
actions |
█████████████████░░░ 86.6% |
717 / 828 |
product_tours |
█████████████████░░░ 87.5% |
1,266 / 1,447 |
exports |
██████████████████░░ 88.3% |
6,891 / 7,800 |
visual_review |
██████████████████░░ 88.5% |
5,565 / 6,287 |
business_knowledge |
██████████████████░░ 88.5% |
4,400 / 4,969 |
conversations |
██████████████████░░ 89.0% |
16,152 / 18,156 |
mcp_analytics |
██████████████████░░ 89.2% |
2,514 / 2,819 |
dashboards |
██████████████████░░ 89.3% |
5,841 / 6,540 |
engineering_analytics |
██████████████████░░ 89.3% |
5,407 / 6,053 |
error_tracking |
██████████████████░░ 89.6% |
9,790 / 10,925 |
alerts |
██████████████████░░ 89.9% |
3,638 / 4,046 |
streamlit_apps |
██████████████████░░ 90.4% |
2,499 / 2,764 |
stamphog |
██████████████████░░ 90.4% |
3,503 / 3,874 |
slack_app |
██████████████████░░ 90.6% |
9,511 / 10,503 |
links |
██████████████████░░ 90.6% |
183 / 202 |
marketing_analytics |
██████████████████░░ 90.8% |
11,514 / 12,684 |
product_analytics |
██████████████████░░ 91.2% |
5,666 / 6,212 |
mcp_store |
██████████████████░░ 91.8% |
3,685 / 4,012 |
managed_migrations |
██████████████████░░ 91.9% |
908 / 988 |
data_warehouse |
██████████████████░░ 92.1% |
18,240 / 19,800 |
workflows |
██████████████████░░ 92.4% |
5,148 / 5,574 |
web_analytics |
███████████████████░ 92.6% |
13,815 / 14,916 |
notifications |
███████████████████░ 92.7% |
1,031 / 1,112 |
ai_observability |
███████████████████░ 92.8% |
14,887 / 16,038 |
surveys |
███████████████████░ 92.9% |
5,689 / 6,122 |
posthog_ai |
███████████████████░ 93.2% |
1,322 / 1,418 |
tracing |
███████████████████░ 93.3% |
2,435 / 2,611 |
approvals |
███████████████████░ 93.3% |
3,395 / 3,640 |
reminders |
███████████████████░ 93.4% |
468 / 501 |
early_access_features |
███████████████████░ 93.8% |
848 / 904 |
legal_documents |
███████████████████░ 94.1% |
1,568 / 1,667 |
endpoints |
███████████████████░ 94.1% |
8,606 / 9,143 |
skills |
███████████████████░ 94.4% |
2,827 / 2,995 |
revenue_analytics |
███████████████████░ 94.5% |
3,598 / 3,809 |
messaging |
███████████████████░ 94.5% |
2,530 / 2,677 |
review_hog |
███████████████████░ 94.6% |
6,619 / 7,000 |
logs |
███████████████████░ 95.3% |
9,561 / 10,032 |
experiments |
███████████████████░ 95.6% |
24,234 / 25,351 |
replay_vision |
███████████████████░ 95.7% |
13,354 / 13,952 |
growth |
███████████████████░ 95.8% |
2,837 / 2,960 |
annotations |
███████████████████░ 96.2% |
732 / 761 |
feature_flags |
███████████████████░ 96.3% |
16,137 / 16,759 |
warehouse_sources |
███████████████████░ 96.3% |
242,846 / 252,166 |
user_interviews |
███████████████████░ 96.4% |
2,242 / 2,325 |
access_control |
███████████████████░ 96.8% |
849 / 877 |
data_catalog |
███████████████████░ 97.2% |
2,117 / 2,179 |
customer_analytics |
███████████████████░ 97.2% |
7,480 / 7,698 |
analytics_platform |
████████████████████ 98.0% |
2,102 / 2,145 |
metrics |
████████████████████ 98.2% |
2,404 / 2,448 |
pulse |
████████████████████ 98.3% |
1,582 / 1,609 |
live_debugger |
████████████████████ 99.2% |
613 / 618 |
field_notes |
████████████████████ 99.4% |
158 / 159 |
Report-only. Patch coverage = changed backend lines covered vs origin/master. Sorted lowest first.
Known gaps: lines covered only by Temporal tests show as uncovered; core line numbers may drift if master changed the same file.
🦔 Hogbox preview · ✅ ready
▶ Open the preview
| 🔑 Login | [email protected] / 12345678 (demo data) |
| 🧩 Running | this PR's backend and frontend, on the PostHog :master base |
| 🔗 Link | stable across rebuilds — a re-push swaps the box underneath, the URL stays |
| 🔒 Access | tailnet only (PostHog VPN) |
| 🛠️ Admin | inspect & debug state in hogland |
| 💤 Idle | sleeps after ~30 min idle (snapshot to S3, zero node cost) and wakes on your next visit in ~30s, behind a brief "waking up" screen |
commit 68cad41 · box box-f3650b0e64dd · ready in 746s (push → usable) · build log · rebuilds on every push, torn down on close
👀 Auto-assigned reviewers
These soft owners were skipped because they only have minor changes here. Nothing blocks merge, so self-assign if you'd like a look:
@PostHog/team-platform-features(posthog/rbac/)
Soft owners come from CODEOWNERS-soft and each product's product.yaml. Generated files and lockfiles are ignored when deciding ownership.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!Comments Outside Diff (1)
products/web_analytics/backend/test/test_heatmap_access_control.py, line 759-764 (link)
user_access_level untested on the list endpoint — which is the path the frontend actually consumes for the per-row delete button (row.user_access_level in HeatmapsScene.tsx). The list endpoint also has a distinct code path: it materialises the queryset to a list() so that UserAccessControlSerializerMixin can preload access controls in one batch query rather than per-row. If that batch path silently returns null for every item, the frontend delete button would be erroneously disabled for editors but no test would catch it.
Reviews (1): Last reviewed commit: "Merge branch 'master' of https://github...." | Re-trigger Greptile
✅ Visual changes approved by @ReeceJones — baseline updated in 6ae2ae1.
2 changed.
PR overview
All previously flagged issues have been addressed. No open security concerns remain on this pull request.
Security review
No open security issues remain on this pull request.
Fixed/addressed: 4 · PR risk: 0/10
@fercgomes tagging you because of the toolbar questions, but I think it should be covered.
@jordanm-posthog tagging you as heatmaps overseer
CI note: Visual regression tests pass is currently failing on master itself (confirmed via run 29363857013), independent of this branch — the failing story is Scenes-App/Customer Analytics/Accounts › RowExpandedUsagePopulated in products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx, timing out waiting for [data-attr="account-expansion"] after the play function completes. This PR doesn't touch customer_analytics at all. Re-ran once on this branch and it failed identically both times, so it's not transient flakiness on our end — it looks like an upstream regression in that area that needs someone with context on the Accounts expansion component. Will keep monitoring for a master fix and re-run once one lands.
🦉 via talyn.dev
Action needed: the visual regression review found 2 changed snapshots (of 3987) — scenes-app-settings-environment--settings-environment-access-control--dark/light. This is the expected change from this PR (adding the "Heatmap" row to the resource access control settings table), not a regression, but it needs a human to review and approve the screenshot diff before Visual regression tests pass can go green: https://us.posthog.com/project/2/visual_review/runs/6198419c-cea5-4dad-a09f-8206b3efac81
🦉 via talyn.dev
Verified: resolve_url_filter is now shared by the serializer and permission check, and the conflicting-filter regression test covers the bypass.
Note on the failing "Frontend typechecking" / "Frontend Tests Pass" checks
These are failing due to a generated-types (kea-typegen) drift in frontend/src/scenes/surveys/surveyLogic.tsx and frontend/src/scenes/surveys/wizard/surveyWizardLogic.ts — files this PR never touches. I confirmed the same check is currently failing on master's own tip commit independently of this branch, so this is a pre-existing break on master, not something introduced here.
Not fixing it in this PR to avoid pulling unrelated file changes into the diff — this should resolve on its own once master is fixed upstream and this branch picks up that fix on its next merge.
🦉 via talyn.dev
Update on "Frontend typechecking" / "Frontend Tests Pass"
This keeps recurring across different unrelated files as master advances (first a kea-typegen drift in the surveys scenes, now an unused-import TS error in products/error_tracking/frontend/logics/issuesDataNodeLogic.tsx) — confirmed each time that the exact master commit merged into this branch already fails the same check on its own, independent of anything in this PR. This looks like ongoing instability on master's frontend typecheck gate (likely from an in-flight Kea-types migration), not something in this PR's diff.
Will keep merging master forward as usual; this specific check should stabilize once master's own frontend typecheck is green again.
🦉 via talyn.dev
Note on "Visual regression tests - chromium (14/16)"
This shard has now failed twice with the same timeout in products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx (a 60s Jest timeout on several play-tests) — a file this PR doesn't touch. Re-running the shard resolves it each time, consistent with a flaky/slow story unrelated to this change.
🦉 via talyn.dev