// Response headers for everything the card app serves. public/_headers carries the same set for // static files (Cloudflare doesn't apply that file to function responses). // img-src allows data: because Wallet Standard wallets hand over their icons as data: URIs. // No upgrade-insecure-requests: WebKit applies it even to a local http dev server (see the site). export const SECURITY_HEADERS: Readonly> = { 'Content-Security-Policy': "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; manifest-src 'self'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'", 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'Permissions-Policy': 'camera=(), microphone=(), geolocation=(), payment=(), usb=(), clipboard-read=()', 'Cross-Origin-Opener-Policy': 'same-origin', 'X-Frame-Options': 'DENY', } export function withHeaders(res: Response): Response { const out = new Response(res.body, res) for (const [k, v] of Object.entries(SECURITY_HEADERS)) out.headers.set(k, v) return out }