# Deployment protection

> Keep previews, or every deployment, private: require a team sign-in, a password or a trusted IP, and let automation in with bypass secrets.

- Category: Security and team
- URL: https://www.forkrail.com/docs/deployment-protection

## Choose what’s protected

| Scope | Protects |
| --- | --- |
| `standard` | Every generated URL: deployment and branch URLs. Production names (your domains and `<project>.<your-domain>`) stay open. |
| `all` | Every URL, production included. |
| `off` | Nothing. |

Set it under the project’s **Settings → Deployment Protection**, or from the CLI. Owners can set the default for every project that has no setting of its own. A fresh install starts with protection off.

```bash
forkrail protection show my-app
forkrail protection set my-app --scope standard --members on
forkrail protection default standard     # owners: every project without its own setting
```

Visitors without access are sent to sign in, if they’re in a browser; other clients get 401.

## Ways in

| Method | For | Set up |
| --- | --- | --- |
| Team sign-in | Members of your team, signed in with GitHub. | `--members on`, or **forkrail Authentication** in settings. |
| Password | Anyone you give it to, without an account. | **Password Protection** in settings. Only its hash is kept. |
| Trusted IPs | Only these addresses may open it, signed in or not. Anyone else gets 404. | `--trusted-ips 203.0.113.0/24` and `--trusted-scope standard|all|production`. |
| Share links | Anyone holding the link. | **Share** on a deployment’s page; take links back under **Shareable Links**. |
| Bypass secrets | Tests, monitors and scripts. | `forkrail protection bypass add`. |
| Exceptions | Hosts that stay public, such as a branch URL for a client. | `--exceptions staging.example.com`. |
| OPTIONS allowlist | CORS preflights on paths you name. | `--options-paths /api`. |

> **Sign everyone out:** `forkrail protection set my-app --sign-out` (or **Sign everyone out** in settings) ends every access given so far: team sign-ins and the password’s and share links’ cookies. Bypass secrets keep working.

## Automation and testing

Make a bypass secret for your end-to-end tests or uptime checks. It’s printed once; only its hash is kept.

```bash
forkrail protection bypass add my-app --env
# --env also makes it the project's FORKRAIL_AUTOMATION_BYPASS_SECRET (and VERCEL_AUTOMATION_BYPASS_SECRET)

curl -H "x-forkrail-protection-bypass: $SECRET" https://my-app-git-feature.example.com/
forkrail curl https://my-app-git-feature.example.com/ -- -i   # the CLI adds access for you
```

The header can also be a query parameter, and `x-vercel-protection-bypass` works too, so Playwright or Cypress setups written for Vercel keep working. Add `x-forkrail-set-bypass-cookie: true` to get a cookie for the rest of a browser session.

## Differences from Vercel

- Password protection, trusted IPs and share links are included. On Vercel, password protection and trusted IPs are paid extras.
- Team sign-in uses your install’s own GitHub App, so only people in your team can get in.
- The scopes match Vercel’s: `standard` is Vercel’s Standard Protection, `all` is All Deployments.
