Skip to content

Add ad.doubleclick.net to CSP connect-src - #2052

Merged
skord merged 2 commits into
mainfrom
mdanko/csp-allow-ad-doubleclick
Aug 12, 2026
Merged

Add ad.doubleclick.net to CSP connect-src#2052
skord merged 2 commits into
mainfrom
mdanko/csp-allow-ad-doubleclick

Conversation

@skord

@skord skord commented Aug 12, 2026

Copy link
Copy Markdown
Member

Issues

No issue filed. Reported by marketing as a problem in the GTM configuration for
approved events: the tag targeting https://ad.doubleclick.net cannot fire
because our CSP blocks it.

Changes

  • Added https://ad.doubleclick.net to the connect-src directive in
    public/nginx.conf.
  • Placed inline immediately after the existing https://stats.g.doubleclick.net
    so the doubleclick hosts stay grouped, and kept on a single line per the
    warning in this file that newlines in the CSP block previously broke prod.

Context on why this was missing: ad.doubleclick.net has never been present in
this file, so this is not a re-add of something previously removed. The other
doubleclick hosts were enumerated in Oct 2024 (#1316, #1332) from observed CSP
violation reports, during a window when connect-src still carried a bare
https: wildcard. That wildcard was dropped in #1346, which is when the
enumeration became restrictive. This host simply never appeared in a report at
the time.

Existing doubleclick coverage for reference:

Directive Hosts
connect-src stats.g.doubleclick.net, ad.doubleclick.net (new)
frame-src td.doubleclick.net
script-src *.g.doubleclick.net

Note that img-src is 'self' data: https:, so image-based pixels on any
doubleclick host were already permitted regardless of this change.

Tests

Manually tested

  • Not verifiable in local dev. This header is served by nginx, and Vite does
    not apply public/nginx.conf under npm start, so the change is inert
    locally. Needs verification in a deployed environment by confirming the GTM
    connect-src violation for ad.doubleclick.net no longer appears in the
    browser console, and that marketing sees the approved events landing.

Automated tests

  • None. There is no test coverage over the nginx CSP header.

Playwright tests ran locally

Not run: this change only affects the nginx-served CSP header, which is not
applied under the Vite dev server these tests run against. Every suite would
behave identically with and without this commit.

  • Admin
  • Captures
  • Collections
  • HomePage
  • Login
  • Materialization

Screenshots

Not applicable, no UI change.

Marketing flagged this as a problem in the GTM configuration for
approved events: GTM reports connect-src violations against
https://ad.doubleclick.net, so the tag cannot fire.

The existing doubleclick entries cover the other directives
(stats.g.doubleclick.net in connect-src, td.doubleclick.net in
frame-src, *.g.doubleclick.net in script-src), but nothing permitted
XHR/beacon traffic to ad.doubleclick.net.

Kept inline on the existing connect-src line, per the warning in this
file that newlines in the CSP block previously broke prod.
@skord
skord requested a review from a team as a code owner August 12, 2026 16:55
@skord skord self-assigned this Aug 12, 2026

@Alex-Bair Alex-Bair left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

⚪ Code Health

No change to the dead-code surface.

48 Unused files

File imported nowhere — delete (or import) it.

     src/hooks/useDelay.ts
     src/hooks/useDraft.ts
     src/pages/NoGrants.tsx
     src/pages/OAuth.tsx
     src/services/encryption.ts
     src/types/global.ts
     src/types/vitest.ts
     src/context/LoopIndex/index.tsx
     src/context/LoopIndex/shared.ts
     src/context/LoopIndex/types.ts
…and 38 more

66 Unused exports

Exported symbol with no references outside its own file — un-export it, or delete it if unused entirely

     src/context/Theme.tsx : logoColors
     src/context/Theme.tsx : intensifiedOutlineThick
     src/context/Theme.tsx : tableAlternateRowsSx
     src/context/Theme.tsx : draggableChipIconSx
     src/context/Theme.tsx : hiddenButAccessibleInput
     src/context/Theme.tsx : primaryColoredBackground_hovered
     src/context/Theme.tsx : detailsPanelBgColor
     src/context/Theme.tsx : menuBackgroundColor
     src/context/Theme.tsx : flexGrowToSiblingsSx
     src/context/Theme.tsx : shardTableRow
…and 56 more

30 Unused exported types

Exported type with no references outside its own file — un-export it, or delete it if unused entirely

     src/utils/billing-utils.ts : FREE_GB_BY_TIER
     src/types/index.ts : InferredSchemas
     src/types/index.ts : Shard
     src/components/shared/WizardDialog/index.ts : WizardStep
     src/api/dataPlanes.ts : AwsDnsEntry
     src/stores/ShardDetail/types.ts : TaskShardDetailsWithShard
     src/stores/ShardDetail/types.ts : ShardDetails
     src/components/tables/Logs/types.ts : RefreshLogsFunction
     src/types/schemaModels.ts : CollectionSchema
     src/components/editor/Bindings/types.ts : SelectedCollectionChangeData
…and 20 more

14 Unused exported enum members

An enum member referenced nowhere

     src/services/supabase.ts : CONNECTOR_TAGS
     src/services/supabase.ts : DRAFTS_EXT
     src/services/supabase.ts : TASKS_BY_DAY
     src/stores/Tables/hooks.ts : accessGrants
     src/stores/Tables/hooks.ts : accessLinks
     src/stores/Tables/hooks.ts : billing
     src/stores/Tables/hooks.ts : connectors
     src/stores/Tables/hooks.ts : entitySelector
     src/stores/Tables/hooks.ts : prefixes
     src/stores/Tables/hooks.ts : prefixAlerts
…and 4 more

5 Unused dependencies

In package.json but never imported

     package.json : @mui/lab
     package.json : @testing-library/jest-dom
     package.json : @urql/exchange-retry
     package.json : logrocket-react
     package.json : stripe

3 Unused devDependencies

In package.json devDependencies but never used

     package.json : @types/logrocket-react
     package.json : @types/react-inspector
     package.json : sharp

@skord
skord merged commit 1e166d1 into main Aug 12, 2026
8 checks passed
@skord
skord deleted the mdanko/csp-allow-ad-doubleclick branch August 12, 2026 17:05
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.

2 participants