Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions apps/cowswap-frontend/vercel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const csp = buildCsp([
['upgrade-insecure-requests', []],
])

const crossOriginOpenerPolicy = process.env.VERCEL_ENV === 'production' ? 'same-origin-allow-popups' : 'unsafe-none'

// ---------------------------------------------------------------------------
// Vercel config
// ---------------------------------------------------------------------------
Expand All @@ -87,9 +89,8 @@ export const config: VercelConfig = {
routes.header('/(.*)', [
// Controls which resources the browser is allowed to load; prevents XSS and data injection attacks.
{ key: 'Content-Security-Policy', value: csp },
// Isolates the browsing context so cross-origin pages cannot access window.opener,
// while still allowing this page to open popups (needed for wallet connections).
{ key: 'Cross-Origin-Opener-Policy', value: 'same-origin-allow-popups' },
// Preview deploys use unsafe-none so Tag Assistant can keep its cross-origin debug connection.
{ key: 'Cross-Origin-Opener-Policy', value: crossOriginOpenerPolicy },
// Allows any origin to load this page as an iframe, required for the embeddable widget.
{ key: 'Cross-Origin-Resource-Policy', value: 'cross-origin' },
// Prevents browsers from MIME-sniffing a response away from the declared Content-Type.
Expand Down
Loading