The skill explains how to configure and roll out CSP headers across Next.js and Vercel, including using Project Routes to change headers without a redeploy. It also covers Page Integrity monitoring for client-side scripts and connections, recommended review practices, and CSP allowances for Vercel products.
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
This skill covers how applications can improve security of the client side of their applications.
Content Security Policy is recommended for all web pages. Set the CSP as an HTTP header. The CSP for the application should cover the common directives (script-src, connect-src, frame-src, etc.) and avoid using overly broad allowances.
Choose a location in code to set the CSP header:
headers() in next.config.js, or SRI (experimental.sri) for hashed scripts. For nonces on CDN-cached HTML, see CSP nonces with CDN cacheheaders in vercel.jsonvercel routes add "CSP" --src "/(.*)" \
--set-response-header "Content-Security-Policy-Report-Only=default-src 'self'"
vercel routes list --diff
vercel routes publishvercel routes publish applies the rules to production right away. Only run it once you're sure the staged rules are correct.
Ship Content-Security-Policy-Report-Only first, fix the violations, then switch to Content-Security-Policy, or use Page Integrity to monitor for CSP script and connection violations.
Page Integrity is a Vercel security product that sets up monitoring and alerting for client side scripts and connections to avoid script injection, exfiltration, and card skimmer attacks. Page Integrity is a paid Beta product requiring Pro or Enterprise and Priority Projects ($200/project/month), plus $2.00 per 1,000 Page Integrity views. Page Integrity is not necessary to use Content Security Policy.
Page Integrity can be enabled via the Vercel CLI:
vercel page-integrity enable --path "/checkout/:path*" --exact /cartIt's recommended to subscribe to notifications in Page Integrity which will send emails, push notifications, or in-product notifications when there are new scripts or connections detected on the page. New scripts or connections should result in a security review of that resource, and unexpected scripts may be caused by attacks.
script-src https://vercel.liveconnect-src https://vercel.live wss://ws-us3.pusher.comimg-src https://vercel.live https://vercel.com data: blob:frame-src https://vercel.livestyle-src https://vercel.live 'unsafe-inline'font-src https://vercel.live https://assets.vercel.com'self' covers them. Don't add third-party Vercel domains for themSee Toolbar with a CSP.
vercel routes CLI: https://vercel.com/docs/cli/routesvercel/vercel-plugin
74b6fd8
vercelvercel routesvercel routes addvercel routes listvercel routes publishvercel page-integrityvercel page-integrity enableIf you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.