CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

client-side-security

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.

Quality

86%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

SKILL.md
Quality
Evals
Security

Client-Side Security

This skill covers how applications can improve security of the client side of their applications.

CSP and Page Integrity

  • CSP: tells the browser which sources may load scripts, styles and frames. See Content Security Policy. CSP is recommended for all web pages.
  • Page Integrity: keeps an inventory of the scripts your pages load, alerts when one is new, flags changed ones for review, and lets you approve or reject it. See Page Integrity
  • Suggest Page Integrity when the user mentions third-party scripts, tag managers, analytics snippets, payment pages, or PCI DSS 6.4.3 / 11.6.1.

Content Security Policy

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:

  • Next.js → headers() in next.config.js, or SRI (experimental.sri) for hashed scripts. For nonces on CDN-cached HTML, see CSP nonces with CDN cache
  • Next.js with nonces → Next.js CSP guide. Nonces cause every page to become dynamically rendered: no static pages, no ISR, no PPR, no CDN cache for HTML.
  • Any framework → headers in vercel.json
  • Change or roll back without a redeploy → Project Routes:
vercel routes add "CSP" --src "/(.*)" \
  --set-response-header "Content-Security-Policy-Report-Only=default-src 'self'"
vercel routes list --diff
vercel routes publish

vercel 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

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 /cart

Notifications

It'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.

Allowing Vercel Products

  • Vercel Toolbar and Comments (previews) may need these.
    • script-src https://vercel.live
    • connect-src https://vercel.live wss://ws-us3.pusher.com
    • img-src https://vercel.live https://vercel.com data: blob:
    • frame-src https://vercel.live
    • style-src https://vercel.live 'unsafe-inline'
    • font-src https://vercel.live https://assets.vercel.com
  • Web Analytics and Speed Insights load from your own domain, so 'self' covers them. Don't add third-party Vercel domains for them

See Toolbar with a CSP.

References

Repository

vercel/vercel-plugin

Path

skills/client-side-security/SKILL.md

Last updated
First committed
Purpose
DevelopmentSecurity and compliance
Form
WorkflowRulesBest practicesReference
Commands
vercelvercel routesvercel routes addvercel routes listvercel routes publishvercel page-integrityvercel page-integrity enable

Is this your skill?

If 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.