| name | vercel-security-basics |
| description | Apply Vercel security best practices for secrets, headers, and access control.
Use when securing API keys, configuring security headers,
or auditing Vercel security configuration.
Trigger with phrases like "vercel security", "vercel secrets",
"secure vercel", "vercel headers", "vercel CSP".
|
| allowed-tools | Read, Write, Edit, Bash(vercel:*), Grep |
| version | 1.18.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","vercel","security","headers","secrets"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Vercel Security Basics
Overview
Secure Vercel deployments with proper secret management, security headers, deployment protection, and access token hygiene. Covers environment variable scoping, Content Security Policy, and preventing common secret exposure patterns.
Prerequisites
- Vercel CLI installed and authenticated
- Access to Vercel dashboard
- Understanding of HTTP security headers
Instructions
Step 1: Secret Management with Environment Variables
vercel env add DATABASE_URL production
vercel env add DATABASE_URL preview
vercel env add DATABASE_URL development
vercel env add API_SECRET production --sensitive
curl -X POST "https://api.vercel.com/v9/projects/my-app/env" \
-H "Authorization: Bearer $VERCEL_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key": "API_SECRET",
"value": "sk-secret-value",
"type": "sensitive",
"target": ["production"]
}'
Critical rule: Never prefix secrets with NEXT_PUBLIC_. Variables starting with NEXT_PUBLIC_ are inlined into the client JavaScript bundle and visible to anyone.
Step 2: Security Headers via vercel.json
{
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "X-Content-Type-Options", "value"