git:20260421.27651a4 to git:20260826.33bd952

234 added, 577 removed. Audit A to A.

What this update changes in the checks

No check changed: every fixed check gives the same answer before and after this update.

A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.

---
name: vercel-firewall
- description: Vercel Firewall and security expert guidance. Use when configuring DDoS protection, WAF rules, rate limiting, bot filtering, IP allow/block lists, OWASP rulesets, Attack Challenge Mode, or any security configuration on the Vercel platform.
+ description: Vercel Firewall expert guidance — automatic DDoS mitigation, the Vercel WAF (custom rules, IP blocking, managed rulesets, rate limiting), Attack Mode, system bypass, bot management, and the `vercel firewall` CLI. Use when configuring platform-level security, responding to attacks, or staging firewall rules.
metadata:
- priority: 5
+ priority: 7
docs:
- - "https://vercel.com/docs/security/vercel-firewall"
- sitemap: "https://vercel.com/sitemap/docs.xml"
- pathPatterns:
- - '.vercel/firewall/**'
+ - 'https://vercel.com/docs/vercel-firewall'
+ - 'https://vercel.com/docs/cli/firewall'
bashPatterns:
- '\bvercel\s+firewall\b'
promptSignals:
phrases:
- - 'rate limit'
- - 'rate limiting'
- - 'firewall'
- - 'WAF'
- - 'DDoS protection'
+ - 'vercel firewall'
+ - 'vercel waf'
+ - 'attack mode'
+ - 'ddos protection'
+ - 'ip block'
+ - 'managed ruleset'
+ - 'bot protection'
+ - 'system bypass'
+ - 'rate limit rule'
+ allOf:
+ - [firewall, vercel]
+ - [waf, vercel]
+ - [ddos, vercel]
+ - [challenge, vercel]
+ - ['rate limit', vercel]
+ - ['system bypass', vercel]
+ - ['ip block', vercel]
+ noneOf: []
minScore: 6
---
# Vercel Firewall
- You are an expert in the Vercel Firewall — a multi-layered security solution with automatic DDoS protection, a customizable Web Application Firewall (WAF), bot management, and rate limiting.
-
- ## Architecture & Rule Execution Order
-
- 1. DDoS mitigation rules (automatic, platform-wide)
- 2. WAF IP blocking rules
- 3. WAF custom rules (in priority order)
- 4. WAF Managed Rulesets (OWASP, Bot Protection, AI Bots)
-
- Changes propagate globally in under **300ms**. No redeployment required.
-
- ## DDoS Protection (Automatic, All Plans)
+ You are an expert in the Vercel Firewall including the `vercel firewall` CLI, Vercel WAF and platform-level protections (custom rules, IP blocks, system bypass, Attack Mode, system mitigations). You follow all the [best practices](#best-practices) outlined below.
- - Layer 3/4 mitigation (automatic, always on)
- - Layer 7 protection (proprietary, tailored to web apps)
- - **Protectd**: Vercel's DoS mitigation infrastructure analyzes ~550K events/sec globally with median mitigation time of **2.5 seconds**
- - 40x faster detection with real-time stream processing
- - Handles 1B+ suspicious TCP connections per week
- - Proven to mitigate 1.37 Tbps attacks with zero downtime
+ ## Core Knowledge
- No configuration needed — DDoS protection is always active.
+ - **Vercel ships a multi-layered firewall**, not just a CDN. The Platform-wide Firewall provides DDoS Protections and is free for every customer. Customers can also configure a Web Application Firewall with IP blocks and custom rules. Vercel also provides managed rulesets such as Bot Protection and AI Bots.
+ - **Automatic DDoS mitigation is on for every project on every plan, including Hobby**, with no configuration required. It covers L3/L4/L7 attacks.
+ - **Vercel does not bill for traffic blocked by DDoS mitigations or WAF.** Usage is only incurred for requests served before mitigation kicked in or not classified as an attack. You do not pay for requests or bandwidth for denies, challenges, or rate-limits from WAF custom rules or managed rules.
+ - **Custom rules** allows the user to define their own Firewall rules. Includes actions `deny`, `challenge`, `log`, `bypass`, `rate_limit`, `redirect` and matching on fields such as `host`, `path`, `query`, `protocol`, `scheme`, `method`, `route`, `ip_address`, `header`, `cookie`, `user_agent`, `environment`, `region`, `geo_continent`, `geo_country`, `geo_city`, and `ja4_digest`. See https://vercel.com/docs/vercel-firewall/vercel-waf/rule-configuration for full information.
- ## WAF Custom Rules
+ ## Overview
- ### Rule JSON Structure
+ Project must be linked first (`vercel link`).
- ```json
- {
- "name": "Block WordPress scanners",
- "description": "Block common WordPress probe paths",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- {
- "type": "path",
- "op": "re",
- "value": "^/wp-(admin|login|content|includes)/"
- }
- ]
- }
- ],
- "action": {
- "mitigate": {
- "action": "deny"
- }
- }
- }
+ ```bash
+ vercel firewall overview # active rules, blocks, bypasses, attack-mode, drafts
+ vercel firewall overview --json
+ vercel firewall diff # show unpublished draft changes
+ vercel firewall diff --json
```
- **Logic**: Each object in `conditionGroup` is an **OR** group. Conditions within a single group are **AND**ed. Multiple groups are **OR**ed.
-
- ### Condition Types (25 available)
-
- | Type | Description | Extra Fields |
- |------|-------------|--------------|
- | `path` | URL path | |
- | `method` | HTTP method | |
- | `host` | Hostname | |
- | `ip_address` | Client IP (supports CIDR) | |
- | `user_agent` | User-Agent string | |
- | `header` | Request header value | `key` (header name) |
- | `query` | Query string parameter | `key` (param name) |
- | `cookie` | Cookie value | `key` (cookie name) |
- | `geo_country` | ISO country code (e.g., `US`) | |
- | `geo_continent` | Continent code (e.g., `NA`) | |
- | `geo_country_region` | State/province code | |
- | `geo_city` | City name | |
- | `geo_as_number` | ASN | |
- | `ja4_digest` | JA4 TLS fingerprint | |
- | `ja3_digest` | JA3 TLS fingerprint | |
- | `target_path` | Resolved path after routing | |
- | `route` | Matched route pattern | |
- | `raw_path` | Raw unparsed path | |
- | `region` | Vercel edge region code | |
- | `protocol` | http/https | |
- | `scheme` | URL scheme | |
- | `environment` | Deployment environment | |
- | `bot_name` | Specific bot name | |
- | `bot_category` | Bot category | |
- | `server_action` | Next.js Server Action ID | |
-
- ### Condition Operators
-
- | Op | Meaning |
- |----|---------|
- | `eq` | Equals |
- | `neq` | Not equals |
- | `re` | Regex match |
- | `pre` | Starts with |
- | `suf` | Ends with |
- | `sub` | Contains |
- | `inc` | In array |
- | `ninc` | Not in array |
- | `ex` | Exists |
- | `nex` | Not exists |
- | `gt` / `gte` | Greater than (or equal) |
- | `lt` / `lte` | Less than (or equal) |
-
- Additional optional fields: `neg: true` negates the condition, `key` required for `header`/`query`/`cookie` types.
-
- ### Mitigation Actions
-
- | Action | Description |
- |--------|-------------|
- | `log` | Log only, allow traffic |
- | `deny` | Block request (403) |
- | `challenge` | JavaScript browser challenge |
- | `bypass` | Skip all subsequent WAF rules |
- | `rate_limit` | Apply rate limiting (requires `rateLimit` config) |
- | `redirect` | Redirect (requires `redirect` config) |
+ `rules` and `ip-blocks` changes are **staged** as drafts — run `vercel firewall publish --yes` to make them live. `system-bypass`, `attack-mode`, and `system-mitigations` take effect **immediately**.
- ### Persistent Actions
+ ## Custom rules
- By default each request is evaluated individually. With **persistent actions**, rules are applied to all matching requests for a customizable duration (`actionDuration`), allowing the firewall to remember malicious behavior and block it earlier in the lifecycle.
+ [Custom rules](https://vercel.com/docs/vercel-firewall/vercel-waf/custom-rules) define traffic policies based on request attributes. Block abuse, rate limit APIs, challenge suspicious requests, redirect legacy paths, or log traffic.
- ### Action Options
+ ### View
- ```json
- {
- "action": {
- "mitigate": {
- "action": "deny",
- "actionDuration": "1h",
- "bypassSystem": false,
- "logHeaders": ["user-agent", "x-forwarded-for"],
- "redirect": {
- "location": "https://example.com/blocked",
- "permanent": false
- }
- }
- }
- }
+ ```bash
+ vercel firewall rules list # table of all rules
+ vercel firewall rules list --expand # show conditions + actions
+ vercel firewall rules list --json
+ vercel firewall rules inspect "My Rule" # full detail of one rule
+ vercel firewall rules inspect "My Rule" --json
```
- ## Practical Rule Examples
+ ### Create — four modes
- ### Block Sanctioned Countries
+ ```bash
+ # AI — TTY only, BLOCKED FOR AGENTS/SCRIPTS
+ vercel firewall rules add --ai "Rate limit /api to 100 requests per minute by IP"
- ```json
- {
- "name": "Block OFAC Sanctioned Countries",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- {
- "type": "geo_country",
- "op": "inc",
- "value": ["CU", "IR", "KP", "RU", "SY"]
- }
- ]
- }
- ],
- "action": {
- "mitigate": { "action": "deny" }
- }
- }
- ```
+ # Interactive wizard — TTY only, BLOCKED FOR AGENTS/SCRIPTS
+ vercel firewall rules add
- ### Require API Key Header on /api/ Routes
+ # Flags — works in scripts and agents
+ vercel firewall rules add "Block crawlers" \
+ --condition '{"type":"user_agent","op":"sub","value":"crawler"}' \
+ --action deny --yes
- ```json
- {
- "name": "Require API Key",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- {
- "type": "header",
- "op": "nex",
- "key": "x-api-key"
- },
- {
- "type": "path",
- "op": "pre",
- "value": "/api/"
- }
- ]
- }
- ],
- "action": {
- "mitigate": { "action": "deny" }
- }
- }
+ # JSON — works in scripts and agents
+ vercel firewall rules add --json '{"name":"Block crawlers","conditionGroup":[{"conditions":[{"type":"user_agent","op":"sub","value":"crawler"}]}],"action":{"mitigate":{"action":"deny"}}}' --yes
```
- ### Block by JA4 TLS Fingerprint
-
- ```json
- {
- "name": "Block Known Malicious JA4",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- {
- "type": "ja4_digest",
- "op": "eq",
- "value": "t13d1516h2_8daaf6152771_b0da82dd1658"
- }
- ]
- }
- ],
- "action": {
- "mitigate": { "action": "deny", "actionDuration": "1h" }
- }
- }
- ```
+ ### Multiple conditions (AND) and OR groups
- ### Block Datacenter ASNs
+ ```bash
+ # AND — multiple --condition flags in the same group
+ vercel firewall rules add "Secure admin" \
+ --condition '{"type":"path","op":"pre","value":"/admin"}' \
+ --condition '{"type":"geo_country","op":"eq","neg":true,"value":"US"}' \
+ --action deny --yes
- ```json
- {
- "name": "Block Known Datacenter ASNs",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- {
- "type": "geo_as_number",
- "op": "inc",
- "value": ["14618", "16509", "15169"]
- }
- ]
- }
- ],
- "action": {
- "mitigate": { "action": "deny" }
- }
- }
+ # OR — use --or to start a new group
+ vercel firewall rules add "Block dangerous methods" \
+ --condition '{"type":"method","op":"eq","value":"DELETE"}' \
+ --or \
+ --condition '{"type":"method","op":"eq","value":"PATCH"}' \
+ --action challenge --yes
```
- ### Challenge cURL Requests
+ ### Edit and manage
- ```json
- {
- "name": "Challenge cURL",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- { "type": "user_agent", "op": "re", "value": "^curl/" }
- ]
- }
- ],
- "action": {
- "mitigate": { "action": "challenge" }
- }
- }
+ ```bash
+ vercel firewall rules edit "My Rule" --action challenge --yes # change action
+ vercel firewall rules edit "My Rule" --name "New Name" --yes # rename
+ vercel firewall rules edit "My Rule" --enabled --yes # enable
+ vercel firewall rules edit "My Rule" --disabled --yes # disable
+ vercel firewall rules edit "My Rule" \
+ --condition '{"type":"path","op":"pre","value":"/new"}' --yes # replace conditions
+
+ vercel firewall rules enable "My Rule"
+ vercel firewall rules disable "My Rule"
+ vercel firewall rules remove "My Rule" --yes # aliases: rm, delete
+ vercel firewall rules reorder "My Rule" --first --yes # move to highest priority
+ vercel firewall rules reorder "My Rule" --last --yes
+ vercel firewall rules reorder "My Rule" --position 3 --yes # 1-based
```
- ## Rate Limiting
+ Rules are evaluated in priority order (top to bottom). Reorder to control which rule matches first.
- ### Rate Limit Rule
+ NOTE: When using `edit` with `--condition`, it will overwrite all conditions listed in the rule. Make sure to specify all conditions when editing a rule.
- ```json
- {
- "name": "API Rate Limit - 100 req/min",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- { "type": "path", "op": "pre", "value": "/api/" }
- ]
- }
- ],
- "action": {
- "mitigate": {
- "action": "rate_limit",
- "rateLimit": {
- "algo": "fixed_window",
- "window": 60,
- "limit": 100,
- "keys": ["ip"],
- "action": "deny"
- }
- }
- }
- }
- ```
+ ### Condition format
- ### Login Endpoint Protection
+ Each `--condition` is a JSON object:
```json
{
- "name": "Login Rate Limit",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- { "type": "path", "op": "eq", "value": "/api/auth/login" },
- { "type": "method", "op": "eq", "value": "POST" }
- ]
- }
- ],
- "action": {
- "mitigate": {
- "action": "rate_limit",
- "rateLimit": {
- "algo": "fixed_window",
- "window": 60,
- "limit": 10,
- "keys": ["ip"],
- "action": "challenge"
- }
- }
- }
+ "type": "path", // condition type (required)
+ "op": "pre", // operator (required)
+ "value": "/api", // value (required for most operators; omit for ex/nex)
+ "key": "Authorization", // required for header / cookie / query types
+ "neg": true // negate the condition (optional, default false)
}
```
- ### Rate Limit Configuration Options
-
- | Field | Type | Description |
- |-------|------|-------------|
- | `algo` | string | `"fixed_window"` (all plans) or `"token_bucket"` (Enterprise) |
- | `window` | number | Seconds. Min 10, max 600 (Pro), max 3600 (Enterprise) |
- | `limit` | number | Max requests per window |
- | `keys` | array | Count per: `"ip"`, `"ja4"`, `"user_agent"`, custom headers (Enterprise) |
- | `action` | string | When exceeded: `"deny"`, `"log"`, `"challenge"` |
+ Conditions within a group are **AND'd**. Multiple groups (separated by `--or`) are **OR'd**.
- When exceeded with `deny`, returns HTTP 429 with `X-RateLimit-Limit` and `X-RateLimit-Remaining` headers.
+ ### Operators
- ## Bot Management
+ `eq`/`neq` (equals), `sub` (contains), `pre` (starts-with), `suf` (ends-with), `re` (regex), `ex`/`nex` (exists; omit `value`), `inc`/`ninc` (in set; `value` is array or comma-separated), `gt`/`gte`/`lt`/`lte` (numeric). Set `neg: true` to negate any operator.
- ### Bot Protection (GA — Free on All Plans)
+ ### Condition types
- Heuristics-based detection that challenges non-browser bot traffic without disrupting verified webhook providers. Formerly "Bot Filter" during beta — renamed to Bot Protection at GA. Enable in log-only mode first to preview traffic impact:
+ - **Request shape**: `path`, `raw_path` (pre-rewrite), `target_path` (post-rewrite), `route` (e.g., `/blog/[slug]`), `server_action`, `method`, `host`, `protocol`, `scheme`, `environment` (preview|production), `region`
+ - **Client**: `ip_address` (IP or CIDR), `user_agent`, `geo_country`, `geo_continent`, `geo_country_region`, `geo_city`, `geo_as_number`
+ - **Headers / cookies / queries** — require `key`: `header`, `cookie`, `query`
+ - **TLS fingerprints**: `ja4_digest` (all plans), `ja3_digest` (Enterprise only)
- ```json
- {
- "action": "managedRules.update",
- "id": "bot_protection",
- "value": { "active": true, "action": "challenge" }
- }
- ```
+ ### Actions
- > **Note**: The older `bot_filter` ID is deprecated. Use `bot_protection` in new configurations.
+ - `deny` — block (403)
+ - `challenge` — show verification page
+ - `log` — log without blocking (use to tune before enforcing)
+ - `bypass` — skip remaining WAF custom rules + managed rulesets
+ - `rate_limit` — throttle by counting key (see Rate limit example for flags)
- ### AI Bot Blocking
+ All actions accept `--duration` (Pro/Enterprise): `1m`, `5m`, `15m`, `30m`, `1h`. Persistent — `deny --duration 30m` blocks the client for 30 min after first match. Without a duration the action evaluates per-request. Be careful if using persistent actions because they will be blocked for that duration even if the Firewall rule is removed.
- Block known AI crawlers (GPTBot, ClaudeBot, etc.):
+ ### Rate limit example
- ```json
- {
- "action": "managedRules.update",
- "id": "ai_bots",
- "value": { "active": true, "action": "deny" }
- }
+ ```bash
+ vercel firewall rules add "Rate limit API" \
+ --condition '{"type":"path","op":"pre","value":"/api"}' \
+ --action rate_limit \
+ --rate-limit-window 60 \
+ --rate-limit-requests 100 \
+ --rate-limit-keys ip \
+ --rate-limit-action deny \
+ --yes
```
- ### Allow a Specific Bot (Bypass Rule)
-
- Place this higher in priority than Bot Protection managed rules:
+ - `--rate-limit-window` — seconds, 10–3600
+ - `--rate-limit-requests` — max per window, 1–10,000,000
+ - `--rate-limit-keys` — count by `ip` (default) or `ja4`. `header:<name>` Enterprise only. Repeatable.
+ - `--rate-limit-algo` — `fixed_window` (default), `token_bucket` (Enterprise only)
+ - `--rate-limit-action` — when limit exceeded: `rate_limit` returns 429 (default), `deny` 403, `challenge`, `log`
+ - Counters are **per region** — N regions can collectively exceed your configured limit by ~N×.
- ```json
- {
- "name": "Allow My Monitoring Bot",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- { "type": "user_agent", "op": "eq", "value": "MyMonitorBot/1.0" }
- ]
- }
- ],
- "action": {
- "mitigate": { "action": "bypass" }
- }
- }
- ```
+ When the user asks for firewall help on a project — or asks "what rate limits should I add?" — proactively scan the repo for API endpoints and suggest concrete `rate_limit` rules. Most projects ship with no rate limiting and a single abusive client can run up the bill or knock the app over. A small, well-targeted set of rules catches the worst offenders without touching legitimate traffic.
- ### Enable BotID (Traffic Visibility)
+ Method scoping matters — `GET /api/foo` and `POST /api/foo` will likely need different rate limits. Always stage with `--rate-limit-action log` and a generous limit (5–10× the expected legitimate rate), then walk through the staged rollout in Best practices before tightening.
- ```json
- { "botIdEnabled": true }
- ```
+ For more sophisticated counting (custom buckets, hashing identifiers from headers/cookies, sliding windows from your own code) point the user at the **Rate Limiting SDK**: https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk.
- ## IP Allow/Block Lists
+ ## IP blocks
- ### Block an IP
+ [IP blocking](https://vercel.com/docs/vercel-firewall/vercel-waf/ip-blocking) blocks IPs or CIDRs entirely. Staged — requires `publish`.
- ```json
- {
- "action": "ip.insert",
- "value": {
- "hostname": "my-site.com",
- "ip": "203.0.113.45",
- "action": "deny",
- "notes": "Malicious scraper"
- }
- }
+ ```bash
+ vercel firewall ip-blocks list
+ vercel firewall ip-blocks list --json
+ vercel firewall ip-blocks block 1.2.3.4 --yes
+ vercel firewall ip-blocks block 10.0.0.0/24 --hostname example.com --yes # scoped to a host
+ vercel firewall ip-blocks block 1.2.3.4 --notes "Abuse report #123" --yes
+ vercel firewall ip-blocks unblock 1.2.3.4 --yes
+ vercel firewall ip-blocks unblock 1.2.3.4 --hostname example.com --yes # disambiguate when blocked on multiple hosts
+ vercel firewall ip-blocks unblock ip_abc123 --yes # by rule ID
```
- ### Block a CIDR Range
-
- ```json
- {
- "action": "ip.insert",
- "value": {
- "hostname": "my-site.com",
- "ip": "203.0.113.0/24",
- "action": "deny",
- "notes": "Bad actor CIDR block"
- }
- }
- ```
+ ## System bypass
- ### Allow an IP (Bypass All Rules)
+ [System bypass rules](https://vercel.com/docs/vercel-firewall/vercel-waf/system-bypass-rules) exempt trusted IPs/CIDRs from **all** firewall checks (office, CI servers, uptime monitors). Immediate — no publish.
- ```json
- {
- "action": "ip.insert",
- "value": {
- "hostname": "my-site.com",
- "ip": "198.51.100.1",
- "action": "bypass",
- "notes": "Internal monitoring IP"
- }
- }
+ ```bash
+ vercel firewall system-bypass list
+ vercel firewall system-bypass list --json
+ vercel firewall system-bypass add 10.0.0.1 --yes
+ vercel firewall system-bypass add 10.0.0.0/24 --yes
+ vercel firewall system-bypass add 10.0.0.1 --domain example.com --yes
+ vercel firewall system-bypass add 10.0.0.1 --domain "*.example.com" --yes # wildcard domain
+ vercel firewall system-bypass add 10.0.0.1 --notes "Office IP" --yes
+ vercel firewall system-bypass remove 10.0.0.1 --yes
```
- ### IP Rule Actions
-
- | Action | Effect |
- |--------|--------|
- | `deny` | Block the IP |
- | `challenge` | Serve JS challenge |
- | `log` | Log traffic only |
- | `bypass` | Allow through all rules (allowlist) |
+ System bypass does **not** override your own custom rules — for that, use a custom rule with `--action bypass`.
- **Note**: `hostname` must match the exact domain. Add separate entries per subdomain.
+ ## Attack mode
- ## OWASP Core Ruleset (CRS)
+ [Attack Mode](https://vercel.com/docs/vercel-firewall/attack-mode) is the emergency response for active attacks. Unverified visitors see a challenge page; verified bots and search crawlers are exempt. Immediate — no publish. **Requires interactive confirmation; blocked for agents/scripts due to severity.**
- ### Individual CRS Rules
+ ```bash
+ vercel firewall attack-mode enable --duration 1h --yes # 1h (default)
+ vercel firewall attack-mode enable --duration 6h --yes
+ vercel firewall attack-mode enable --duration 24h --yes
+ vercel firewall attack-mode disable --yes
+ ```
- | ID | Protection |
- |----|-----------|
- | `sqli` | SQL Injection |
- | `xss` | Cross-Site Scripting |
- | `rce` | Remote Code Execution |
- | `lfi` | Local File Inclusion |
- | `rfi` | Remote File Inclusion |
- | `sd` | Scanner Detection |
- | `ma` | Multipart Attack |
- | `php` | PHP-specific exploits |
- | `gen` | Generic attack patterns |
- | `sf` | Session Fixation |
- | `java` | Java-specific exploits |
+ ## System mitigations
- ### Enable OWASP Rules
+ Vercel automatically [mitigates DDoS attacks](https://vercel.com/docs/vercel-firewall/ddos-mitigation). In rare cases (debugging false positives) you may need to pause them. Auto-resumes after 24h. Immediate. **Blocked for agents/scripts due to severity — pausing removes DDoS protection.**
- ```json
- {
- "action": "crs.update",
- "id": "sqli",
- "value": { "active": true, "action": "deny" }
- }
+ ```bash
+ vercel firewall system-mitigations pause --yes # 24h, auto-resume
+ vercel firewall system-mitigations resume --yes
```
- ### Full OWASP + Bot Configuration (PUT)
+ ## Publishing
- ```json
- {
- "firewallEnabled": true,
- "crs": {
- "sqli": { "active": true, "action": "deny" },
- "xss": { "active": true, "action": "deny" },
- "rce": { "active": true, "action": "deny" },
- "lfi": { "active": true, "action": "deny" },
- "rfi": { "active": true, "action": "deny" },
- "sd": { "active": true, "action": "log" },
- "ma": { "active": true, "action": "deny" },
- "gen": { "active": true, "action": "deny" },
- "sf": { "active": true, "action": "deny" },
- "php": { "active": false, "action": "log" },
- "java": { "active": false, "action": "log" }
- },
- "managedRules": {
- "owasp": { "active": true, "action": "deny" },
- "bot_protection": { "active": true, "action": "challenge" },
- "ai_bots": { "active": true, "action": "deny" }
- },
- "botIdEnabled": true
- }
+ ```bash
+ vercel firewall diff # review staged changes
+ vercel firewall publish --yes # push drafts to production
+ vercel firewall discard --yes # throw away drafts
```
- ## Firewall REST API
-
- Base URL: `https://api.vercel.com`
- Auth: `Authorization: Bearer <VERCEL_TOKEN>`
- Query params: `?projectId=<id>&teamId=<id>`
-
- ### Endpoints
+ ## Querying firewall metrics from the CLI
- | Method | Path | Description |
- |--------|------|-------------|
- | `GET` | `/v1/security/firewall/config/active` | Read current config |
- | `PATCH` | `/v1/security/firewall/config` | Incremental update (add/remove/update rules) |
- | `PUT` | `/v1/security/firewall/config` | Full config replacement |
- | `POST` | `/v1/security/firewall/bypass` | Create temporary bypass rule |
+ If the project has **Observability Plus**, `vc metrics` returns firewall counters that you can analyze without leaving the terminal — useful for the "review traffic" step in the staged rollout, or for spotting which rules are doing real work.
- ### PATCH Actions
+ ```bash
+ vc metrics vercel.firewall_action.count \
+ --group-by waf_rule_id \
+ --group-by waf_action \
+ --since 3d \
+ --granularity 4h \
+ --format json
+ ```
- | Action | Description |
- |--------|-------------|
- | `firewallEnabled` | Enable/disable firewall (value: boolean) |
- | `rules.insert` | Add a custom rule |
- | `rules.update` | Update rule (requires `id`) |
- | `rules.remove` | Delete rule (requires `id`) |
- | `rules.priority` | Reorder rule (requires `id`, value = index) |
- | `ip.insert` | Add IP rule |
- | `ip.update` | Update IP rule |
- | `ip.remove` | Delete IP rule |
- | `crs.update` | Enable/configure OWASP CRS rule |
- | `crs.disable` | Disable entire CRS |
- | `managedRules.update` | Configure managed ruleset |
+ - `--group-by waf_rule_id` — break out hits per rule. Match the IDs to `vercel firewall rules list --json` to see which rule fired.
+ - `--group-by waf_action` — splits `log` / `deny` / `challenge` / `rate_limit` / `bypass` so you can tell what actually got enforced versus only logged.
+ - `--since` accepts `1h`, `24h`, `3d`, `7d`, etc.; `--granularity` is the bucket size.
+ - `--format json` is best for programmatic review; drop it for a human-readable table.
- ### Add a Rule via cURL
+ For an **active-attack triage** lens — "is something happening right now?" — narrow the window and tighten the granularity:
```bash
- curl -X PATCH "https://api.vercel.com/v1/security/firewall/config?projectId=prj_xxx&teamId=team_xxx" \
- -H "Authorization: Bearer $VERCEL_TOKEN" \
- -H "Content-Type: application/json" \
- -d '{
- "action": "rules.insert",
- "value": {
- "name": "Block WordPress scanners",
- "active": true,
- "conditionGroup": [
- {
- "conditions": [
- { "type": "path", "op": "re", "value": "^/wp-(admin|login|content|includes)/" }
- ]
- }
- ],
- "action": { "mitigate": { "action": "deny" } }
- }
- }'
+ vc metrics vercel.firewall_action.count \
+ --group-by waf_action \
+ --since 1h \
+ --granularity 5m \
+ --format json
```
- ### Vercel SDK Usage
+ Other dimensions and metric names exist; run `vc metrics --help` to discover them, and check https://vercel.com/docs/cli/metrics for the full catalog. If the command errors with "metrics not enabled" or similar, the project isn't on Observability Plus — fall back to the dashboard URL (`/firewall/traffic?filter=<ruleId>`) for the same data.
- ```ts
- import { Vercel } from '@vercel/sdk'
+ ## Best practices
- const vercel = new Vercel({ bearerToken: process.env.VERCEL_TOKEN })
+ The firewall sits in front of every request. A misconfigured rule can block real users, kill SEO crawlers, or break checkout. Treat changes like a production database migration: stage, review, and let the user pull the trigger.
- // Read current firewall config
- const config = await vercel.security.readFirewallConfig({
- configVersion: 'active',
- projectId: 'prj_xxx',
- teamId: 'team_xxx',
- })
+ - **Roll new rules out in stages, not in one shot.** A new rule's blast radius is unpredictable until real traffic hits it. Walk every meaningful rule through the stages below, asking the user to `vercel firewall publish --yes` between each. Don't skip stages even if a rule "obviously" matches only attackers — common JA4s and user agents collide with real users far more often than they look like they will.
+ 1. **Log everywhere.** Add the rule with `--action log` so it records hits to the Firewall dashboard but blocks nothing.
- // Add a rule
- await vercel.security.updateFirewallConfig({
- projectId: 'prj_xxx',
- teamId: 'team_xxx',
- requestBody: {
- action: 'rules.insert',
- value: {
- name: 'Rate limit API',
- active: true,
- conditionGroup: [
- { conditions: [{ type: 'path', op: 'pre', value: '/api/' }] },
- ],
- action: {
- mitigate: {
- action: 'rate_limit',
- rateLimit: { algo: 'fixed_window', window: 60, limit: 100, keys: ['ip'], action: 'deny' },
- },
- },
- },
- },
- })
- ```
+ ```bash
+ vercel firewall rules add "Block exploit probes" \
+ --condition '{"type":"path","op":"inc","value":["/wp-admin","/.env","/.git/config","/phpmyadmin"]}' \
+ --action log --yes
+ ```
- ### Create Temporary Bypass (Attack Challenge Mode)
+ 2. **Have the user review traffic in the dashboard.** Get the rule ID from the `rules add` output or `vercel firewall rules list --json` (look for the `id` field — rule IDs start with `rule_`). Read the team and project slugs from `.vercel/project.json` (`orgSlug` / `projectName`) or via `vercel project ls`. Construct the filtered traffic URL and ask the user to open it:
- ```bash
- curl -X POST "https://api.vercel.com/v1/security/firewall/bypass?projectId=prj_xxx&teamId=team_xxx" \
- -H "Authorization: Bearer $VERCEL_TOKEN" \
- -H "Content-Type: application/json" \
- -d '{
- "domain": "my-site.com",
- "sourceIp": "198.51.100.42",
- "ttl": 3600000,
- "note": "Temporary bypass for load testing"
- }'
- ```
+ ```
+ https://vercel.com/<team>/<project>/firewall/traffic?filter=<ruleId>
+ ```
- ## vercel.json WAF Rules
+ Have them confirm only the intended traffic is matching (no real users, no SEO crawlers, no internal tools) before moving on.
- Declaratively define firewall rules in `vercel.json` using the `mitigate` key:
+ 3. **Block in preview first.** Edit the rule to `deny` (or `challenge`) and add an `environment = preview` condition so production stays in log mode. This lets the user hit a preview deployment and confirm the block fires correctly without exposing real users:
- ```json
- {
- "$schema": "https://openapi.vercel.sh/vercel.json",
- "routes": [
- {
- "src": "/api/(.*)",
- "missing": [
- { "type": "header", "key": "x-internal-token" }
- ],
- "mitigate": { "action": "deny" }
- },
- {
- "src": "/(.*)",
- "has": [
- { "type": "header", "key": "user-agent", "value": "(?i)^curl/" }
- ],
- "mitigate": { "action": "challenge" }
- }
- ]
- }
- ```
+ ```bash
+ vercel firewall rules edit "Block exploit probes" \
+ --action deny \
+ --condition '{"type":"path","op":"inc","value":["/wp-admin","/.env","/.git/config","/phpmyadmin"]}' \
+ --condition '{"type":"environment","op":"eq","value":"preview"}' \
+ --yes
+ ```
- Supported actions in `vercel.json`: `"challenge"`, `"deny"` only. Rate limiting, `log`, and `bypass` require the Vercel Firewall dashboard at `https://vercel.com/{team}/{project}/firewall` or the REST API.
+ Have the user publish, then test the affected paths in a preview URL. Re-check the dashboard URL filtered by rule ID to see the blocks land.
- ## Attack Challenge Mode
+ 4. **Block in production.** Once the user is satisfied with the production log data, edit to `deny` / `challenge` and have them publish. Keep the dashboard URL handy for the first 24h in case you need to roll back with `--action log` or `rules disable`.
- - Available on all plans (free)
- - Shows browser verification challenge to all visitors during active attacks
- - Legitimate bots (Googlebot, webhook providers) automatically pass through
- - Internal Function-to-Function calls within the same account bypass automatically
- - Blocked requests don't count toward CDN/traffic usage
- - Configured via dashboard only: open `https://vercel.com/{team}/{project}/firewall` → **Bot Management** → **Attack Challenge Mode**
+ - **Stage drafts; let the user publish.** Mutating commands (`rules add/edit/enable/disable/remove/reorder`, `ip-blocks block/unblock`) only stage. Run `vercel firewall diff` to show what will change, then **ask the user to run `vercel firewall publish --yes` themselves** — don't push to production on their behalf. Use `discard --yes` only if the user asks to abandon staged changes.
- ## Plan Availability
+ - **Don't run commands the CLI blocks for agents.** Surface what the user needs to do instead:
+ - `vercel firewall rules add --ai "..."` and `vercel firewall rules add` (wizard) — TTY-only. Use `--condition` flags or `--json`.
+ - `vercel firewall attack-mode enable` — requires explicit interactive confirmation; have the user run it.
+ - `vercel firewall system-mitigations pause` — pauses platform DDoS protection across the project; have the user run it and resume ASAP.
- | Feature | Hobby | Pro | Enterprise |
- |---------|-------|-----|-----------|
- | DDoS Protection | All | All | All |
- | Custom Rules | 5 | 40 | 1000 |
- | Rate Limiting | 1 rule | 40 rules | 1000 rules |
- | Bot Protection (GA) | Yes | Yes | Yes |
- | OWASP CRS | — | — | Yes |
- | Token Bucket algo | — | — | Yes |
- | Custom rate limit keys | — | — | Yes |
+ - **Inspect before recommending publish.** A `deny` with a loose condition (e.g., `path` starts with `/`) blocks the entire site. Always `vercel firewall rules inspect "Name" --expand` and `vercel firewall diff` before handing the publish step to the user.
- ## Observability
+ - **Tune rate limits gently.** Start with a generous `--rate-limit-requests` (5–10× the expected legitimate rate) and `--rate-limit-action log`. After the user reviews dashboard data, tighten the limit and switch the action to `rate_limit`, `challenge`, or `deny`.
- - Security event logs in the Firewall tab
- - **IP enrichment** — hover any IP in the Firewall dashboard to see ASN, location, and metadata
- - Create custom WAF rules directly from dashboard traffic charts (select "Create Custom Rule" from the actions menu)
- - Linkable to Monitoring queries for investigations
- - DDoS mitigation notifications (alerts on detection)
- - BotID traffic visibility when enabled
+ - **Keep bypasses narrow.** When unblocking trusted automation, scope by a shared-secret header **plus** an IP or CIDR. Avoid wide-open bypasses (e.g., a single header with a known value an attacker could guess).
+ - **Don't over-block.** User agents, JA4, and IP addresses may collide with real users far more than they look like they will:
+ - **JA4 fingerprints are shared across millions of clients.** A single Chrome point release, a single iOS version, or a popular mobile SDK all produce the same JA4. "Block this JA4" can silently take out an entire browser cohort. Before recommending a JA4 rule, run it through the staged log → preview → log-prod → block flow above and have the user confirm the dashboard shows only attacker behavior (high request rate, suspicious paths, anomalous geos) — not just "this JA4 hit `/login` once."
+ - **User-agent substring rules over-match constantly.** `sub` matches like `crawler`, `bot`, `python`, `curl`, or `headless` will block legitimate tools (uptime monitors, link previewers, SEO auditors, partner integrations, the user's own CI). For known-good crawlers (Googlebot, Bingbot, Slack/Discord/X unfurlers, etc.) prefer Vercel's verified-bot signals over UA strings, and pair UA conditions with another condition (path, geo, rate) so a single UA token can't take down a whole class of clients.
+ - **Sanity-check before staging.** Before adding a block, ask the user: "Does this fingerprint also match Chrome on macOS / our mobile app / a partner's webhook?" If you don't know, the answer is "log first, decide later."
+
+ ## External reverse proxies
+
+ External proxies in front of Vercel reduce firewall and Bot Protection accuracy: real client IPs become opaque, signal reliability drops, legitimate users may be repeatedly challenged. Avoid when you can. If required, use **Verified Proxy** so Vercel trusts your proxy's headers from a known egress range. https://vercel.com/docs/security/reverse-proxy
+
## Official Documentation
- - [Vercel Firewall Overview](https://vercel.com/docs/vercel-firewall)
- - [Custom Rules](https://vercel.com/docs/vercel-firewall/vercel-waf/custom-rules)
- - [Rate Limiting](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting)
- - [IP Blocking](https://vercel.com/docs/vercel-firewall/vercel-waf/ip-blocking)
- - [Managed Rulesets](https://vercel.com/docs/vercel-firewall/vercel-waf/managed-rulesets)
- - [Attack Challenge Mode](https://vercel.com/docs/vercel-firewall/attack-challenge-mode)
- - [Firewall API Guide](https://vercel.com/docs/vercel-firewall/firewall-api)
- - [REST API Reference](https://vercel.com/docs/vercel-firewall/firewall-api)
+ - [Vercel Firewall](https://vercel.com/docs/vercel-firewall)
+ - [Bot management](https://vercel.com/docs/bot-management)
+ - [Vercel CLI](https://vercel.com/docs/cli/firewall)