Skip to content

fix(security): bundle PostHog extensions instead of loading them remotely - #1083

Open
0xalpharush wants to merge 3 commits into
mainfrom
pyramid/3eeb1feb-036b-4f3b-b4d3-e4e1dfcb127d
Open

0xalpharush wants to merge 3 commits into
mainfrom
pyramid/3eeb1feb-036b-4f3b-b4d3-e4e1dfcb127d

Conversation

@0xalpharush

@0xalpharush 0xalpharush commented Oct 30, 2026 •

Copy link
Copy Markdown

Fixes findings from the frontend Subresource Integrity (SRI) audit.

Reference Action Why
src/components/GoogleAnalytics.tsx: injects googletagmanager.com/gtag/js?id=${VITE_GA_MEASUREMENT_ID} Kept, can't be fixed Used: this repo serves tempo.xyz/developers (Vercel project tempo-docs, deploying from main), and the live GoogleAnalytics chunk has G-EZ3TK5434J built in. gtag.js is a vendor loader that can't be pinned. It renders nothing when the ID is unset. Nothing else loads gtag or GTM on these pages, so it isn't a duplicate.
src/components/PostHogSetup.tsx: posthog-js (npm) lazy-loads exception-autocapture.js (and dead-clicks-autocapture.js when enabled remotely) from /ingest/static (rewritten to us-assets.i.posthog.com in vercel.json) with no SRI Bundled: dynamically imports posthog-js/dist/{dead-clicks,exception}-autocapture with posthog-js and sets disable_external_dependency_loading: true No remote PostHog scripts at runtime. Exception and dead-click capture keep working. Remote config falls back to its JSON endpoint. Toolbar, surveys and remotely enabled web vitals no longer load (replay was already disabled).

No other remote <script>, stylesheet, modulepreload or https ESM import is in the served code (searched src, public, vocs.config.ts and vite.config.ts).

Checks: I didn't install dependencies or run checks locally because the shared Hand was out of memory. This is a 9-line change in one file; CI (verify.yml) covers typecheck, lint and build.

@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tempo-docs Ready Ready Preview Oct 30, 2026 9:49pm UTC

Request Review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings marked 🟡 are optional suggestions and need no follow-up push.

Comment thread src/components/PostHogSetup.tsx Resolved
Comment thread src/components/PostHogSetup.tsx Resolved

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no new issues

No new issues were found in this update; 2 findings from earlier reviews are still open above.

Still open from earlier reviews (2):

  • 🔴 src/components/PostHogSetup.tsx:28 — If the PostHog project has web vitals or surveys turned on remotely, docs visitors will silently stop sending web-vital…
  • Also unresolved: 1 minor or pre-existing.

If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new blocking issues. 1 optional suggestion (a nit or a note on pre-existing code) was found and not posted.

This branch was successfully deployed

1 active deployment
Preview — 0b6bb423 Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant