Skip to content

fix(csp): allow X (Twitter) conversion pixel domains on hosted#5804

Merged
waleedlatif1 merged 1 commit into
stagingfrom
worktree-investigate-twitter-csp
Jul 21, 2026
Merged

fix(csp): allow X (Twitter) conversion pixel domains on hosted#5804
waleedlatif1 merged 1 commit into
stagingfrom
worktree-investigate-twitter-csp

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The X (Twitter) conversion pixel injected on hosted landing pages tries to load uwt.js from static.ads-twitter.com, but that domain isn't in the CSP script-src, so the browser blocks it — the pixel never loads and every landing pageview logs a CSP violation.
  • Add https://static.ads-twitter.com to script-src so uwt.js loads.
  • Add https://analytics.twitter.com to connect-src so the pixel's conversion beacons (fetch/sendBeacon) can fire. The t.co image-pixel fallback is already covered by the https: wildcard in img-src.
  • Both additions are gated behind isHosted, matching where the pixel <Script> is injected. Restores X ad conversion tracking and clears the console error.

Type of Change

  • Bug fix

Testing

Verified the live www.sim.ai CSP header lacked the ads-twitter/analytics.twitter domains; confirmed the injected pixel base code targets those domains. All 28 CSP tests pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 21, 2026 6:02pm

Request Review

@cursor

cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Hosted-only CSP allowlist additions for known third-party tracking domains; no auth, data, or app logic changes.

Overview
Fixes blocked X conversion tracking on hosted landing pages by extending the hosted-only CSP allowlists so the pixel injected in the landing layout can load and send events.

Adds https://static.ads-twitter.com to script-src so uwt.js can load, and https://analytics.twitter.com to connect-src for fetch/sendBeacon conversion beacons. Both entries sit alongside the existing HubSpot/GTM hosted analytics sources in csp.ts; non-hosted builds are unchanged.

Reviewed by Cursor Bugbot for commit 527a60d. Configure here.

@waleedlatif1
waleedlatif1 force-pushed the worktree-investigate-twitter-csp branch from 527a60d to 5bc957e Compare July 21, 2026 18:02
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR allows the hosted X conversion pixel through the content security policy. The main changes are:

  • Adds static.ads-twitter.com to hosted script-src.
  • Adds analytics.twitter.com to hosted connect-src.
  • Keeps both permissions aligned with the hosted-only pixel injection.

Confidence Score: 5/5

This looks safe to merge.

  • The script source matches the injected uwt.js origin.
  • The connection source covers the configured analytics host.
  • Both permissions use the same hosted-only condition as the pixel injection.
  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/lib/core/security/csp.ts Adds exact hosted-only CSP sources for the X conversion script and its analytics requests.

Reviews (1): Last reviewed commit: "fix(csp): allow X (Twitter) conversion p..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit e01cd2c into staging Jul 21, 2026
11 of 13 checks passed
@waleedlatif1
waleedlatif1 deleted the worktree-investigate-twitter-csp branch July 21, 2026 18:17
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