Deployment security
Deployment security keeps application releases safe to expose and safe to operate. It connects release settings, environment boundaries, browser protections, and final checks so that a deployed application does not reveal internal data or trust unsafe origins.
Deployment posture
Deployment review treats production as a public boundary. The goal is to reduce what an outside user can learn from the running service and to ensure that each release uses controls suited to its environment.
Production exposure
Production must not expose debug views, source maps, or repository data. These resources can reveal stack traces, internal paths, source code, commit history, or past secrets. The release check also confirms that error responses stay useful without disclosing internal details.
References: vibe-security/…/deployment.md• L3-7 vibe-security/…/deployment.md• L36-43
Environment separation
Each environment has a separate trust level and must use matching credentials. Production serves live users with real keys, while preview and development environments use test or local credentials. Preview URLs may be reachable by anyone who has the URL, so they must never connect to production APIs, databases, or payment services.
References: vibe-security/…/deployment.md• L9-19
Response protections
Response protections limit what browsers can load, where the application can run, and how much request context it sends to other sites. These controls support the broader reliability and misuse defenses described in Application resilience guidance and complement Rate limiting security.
Security headers
Security headers give browsers a clear policy for content, transport, framing, type handling, referrers, and device permissions. Start with a restrictive Content Security Policy, then add only the sources the application needs. Apply the header set to all responses so that protection does not depend on a particular route.
References: vibe-security/…/deployment.md• L21-34
Cross-origin access
Cross-Origin Resource Sharing (CORS) controls which other origins may call the application from a browser. Authenticated endpoints must allow only known application domains. Credentialed requests require explicit origins and must not be paired with a wildcard origin.
References: vibe-security/…/deployment.md• L45-49
Release review
Release review turns deployment security into a short gate before public exposure. It checks both the repository and the running behavior because a safe source tree can still produce an unsafe deployment.
When a release moves toward production, the review follows this path:
flowchart LR
A[Repository and history] --> B[Environment settings]
B --> C[Production response checks]
C --> D[Cross-origin checks]
D --> E[Safe release]
Pre-release checks
The review scans repository history for leaked secrets, confirms environment files are excluded from version control, and verifies that debug mode and verbose logging are off. It then checks error pages, CORS behavior, and public access to repository paths before release.
References: vibe-security/…/deployment.md• L36-49
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to production, preview, or development settings must preserve separate credentials and service targets.
- Changes to response handling must preserve security headers on every response, including errors.
- Changes to browser access rules must keep authenticated CORS origins explicit and limited to trusted domains.
- Changes to build or server settings must re-check debug output, source maps, verbose logs, and repository-path exposure.
- Changes to environment-file handling must preserve version-control exclusions and trigger a history scan for leaked secrets.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A preview deployment uses production credentials | An unknown visitor can reach live data or services through the preview | Give each environment separate keys and service targets |
| Debug mode, source maps, or verbose errors remain enabled in production | Attackers learn source code, paths, stack details, or configuration | Check the built and running deployment before release |
The .git directory is publicly reachable | The source and commit history can be downloaded, including old secrets | Block repository paths at the deployment boundary and test the public URL |
| An authenticated endpoint allows wildcard CORS | An untrusted site can make browser requests across origins | Use a fixed allowlist and pair credentials only with explicit origins |
| A permissive Content Security Policy is added without review | Unexpected scripts or content can run in the browser | Start with a restrictive policy and allow only required sources |
Key files
| File | Why to read it |
|---|---|
| vibe-security/…/deployment.md | Defines the deployment review scope for production settings, environment separation, response headers, release checks, and CORS. |
| vibe-security/SKILL.md | Shows where deployment configuration fits in the wider security review sequence and how findings are prioritized. |