Application resilience guidance
Application resilience guidance protects interfaces and deployments from abuse, accidental exposure, and unsafe change. It joins request controls with safe production settings so that the application can keep serving valid users without exhausting services or revealing sensitive system data.
Resilience scope
Resilience starts at the public interface and continues through the services and environments that support it. The review checks both deliberate misuse and operational mistakes because either can reduce availability or widen access to protected systems.
The guidance centers on two linked areas:
- Request and service protection: Limit costly or repeatable actions before they consume compute, messaging, file-processing, or provider capacity. See Rate limiting security.
- Release and runtime protection: Keep production, preview, and development environments separate. Remove debug exposure and apply browser and cross-origin controls before release. See Deployment security.
Abuse resistance
Abuse resistance keeps a caller from turning a useful interface into a password-guessing tool, spam relay, denial-of-service path, or uncontrolled spending path. Controls must cover both the user identity and the network source because either signal alone is easy to bypass.
Rate limits are most important on authentication, AI, email or SMS, file-processing, and webhook-like interfaces. Counters must live in a trusted control point rather than a public data table that a caller can reset. Usage quotas, provider spending caps, billing alerts, and anomaly monitoring extend the same protection to downstream services.
The detailed review rules and bypass checks are in Rate limiting security.
Environment safety
Environment safety prevents a release or preview from exposing internal details or gaining access to live systems by mistake. Each environment needs its own keys and data boundary, while production must avoid diagnostic settings that reveal stack traces, paths, source, or configuration.
Preview deployments require special care because their URLs may be shared outside the team. They must use test or staging credentials rather than production API keys, database credentials, or payment keys. Production responses also need restrictive security headers and a cross-origin policy that names approved domains instead of allowing every origin.
The release checks and runtime controls are in Deployment security.
Resilience review flow
This flow shows how an interface request is protected from abuse and how the resulting application state is carried into a safe release.
flowchart LR
A[Incoming request] --> B[Trusted abuse controls]
B -->|Allowed| C[Application service]
B -->|Rejected| D[Safe failure response]
C --> E[Protected dependent services]
E --> F[Environment and release checks]
F --> G[Controlled deployment]
The request path must reject excessive use before it reaches an expensive operation. The release path must then ensure that the running environment does not undo that protection through exposed diagnostics, mixed credentials, weak headers, or broad cross-origin access.
Security boundaries
Resilience depends on boundaries that callers cannot change. A public request may identify a user or source, but it must not control its own quota, select live credentials, or decide which environment is trusted.
| Boundary | Required protection | Failure prevented |
|---|---|---|
| Caller to interface | Per-IP and per-user limits at a trusted layer | Brute force, account creation abuse, and source rotation |
| Interface to dependent service | Usage quotas and hard provider limits | Cost exhaustion and downstream overload |
| Environment to environment | Separate keys, data, and provider accounts | Preview or development access to live systems |
| Runtime to browser | Restrictive headers and approved origins | Script injection, framing, unsafe content handling, and credentialed cross-origin access |
Change checklist
When these files or sections are changed, remember to consider these:
- When a new costly or repeatable interface is added, place it under both user and source limits before it can call a dependent provider.
- When rate-limit storage changes, confirm that callers cannot read or reset counters through a public data interface.
- When a deployment target or environment changes, map its credentials to test or live systems explicitly and keep preview access away from production secrets.
- When response or proxy settings change, recheck the security headers and the allowed-origin list together. Credentialed requests must not use a wildcard origin.
- When production diagnostics change, verify that debug pages, source maps, stack traces, verbose logs, and repository metadata remain inaccessible.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Rate counters are stored in a public table | A caller resets its own limit and continues abuse | Use a trusted private store, middleware, or gateway |
| Only IP or only user limits are applied | Attackers bypass controls by rotating addresses or accounts | Combine per-IP and per-user limits |
| A preview uses production credentials | An exposed preview can read or change live data | Use environment-specific test or staging credentials |
| Debug mode or source maps remain enabled in production | Errors or client tools reveal internal code and settings | Disable debug output and production source maps |
| Authenticated endpoints allow every origin | A foreign site can make credentialed requests | Allow only approved origins and avoid wildcard CORS |
Key files
| File | Why to read it |
|---|---|
| vibe-security/SKILL.md | Defines the security review sequence and places resilience checks beside identity, data, payment, mobile, and AI concerns. |
| vibe-security/…/rate-limiting.md | Defines the abuse targets, trusted counter locations, combined caller limits, and billing safeguards. |
| vibe-security/…/deployment.md | Defines production settings, environment separation, response headers, release checks, and cross-origin rules. |
| vibe-security/…/secrets-and-env.md | Explains which environment values may be public and which must remain server-side when environments are configured. |