TL;DR
On April 19, 2026, Vercel disclosed that attackers compromised their internal systems through a third-party AI tool’s OAuth integration, exposing customer environment variables stored without encryption at rest. The breach reveals seven critical lessons every API developer should apply: encrypt secrets at rest, audit OAuth grants from AI dev tools, treat environment variables as sensitive by default, automate credential rotation, secure CI/CD, build APIs with secure defaults, and prepare an incident response playbook before you need one.
💡 Apidog integrates with HashiCorp Vault, Azure Key Vault, and AWS Secrets Manager to help keep API credentials encrypted and rotated. You can also test 13 authentication methods, including OAuth 2.0 and mTLS, in one workspace.
Introduction
A single OAuth grant to a small AI tool called Context.ai gave attackers a path into Vercel’s internal systems. From there, they accessed customer environment variables, API keys, database credentials, and deployment tokens that were not encrypted at rest.
The breach did not happen because Vercel forgot HTTPS. It happened because of architectural assumptions:
- Developers had to manually mark secrets as “sensitive”
- Third-party AI integrations were treated as low-risk
- OAuth scopes granted to productivity tools were not continuously audited
If you build or consume APIs, this incident is directly relevant. Most API workflows rely on the same building blocks: environment variables, OAuth integrations, CI/CD pipelines, and third-party developer tools.
This guide breaks down seven practical lessons from the Vercel breach and shows what API teams can do now.
What happened: the Vercel April 2026 breach
The attack chain
Between April 17 and April 19, 2026, an attacker compromised Context.ai’s Google Workspace OAuth application. Context.ai is an AI observability tool. It was not a major identity provider, but it had OAuth access to a Vercel employee’s Google Workspace account.
The attack chain looked like this:
- The attacker compromised Context.ai’s OAuth app.
- They used that OAuth access to take over a Vercel employee’s Google account.
- They inherited permissions available to that employee.
- They escalated into Vercel’s internal systems.
- They accessed customer-facing data stores.
- They extracted environment variables that customers had not marked as “sensitive”.
Vercel described the attacker as “highly sophisticated based on their operational velocity and detailed understanding of Vercel’s systems.”
What was exposed
Confirmed compromised:
- Customer environment variables not marked “sensitive”
- API keys
- Database URLs
- Signing keys
- Deployment tokens
- 580 employee records, including names, Vercel emails, account status, and activity timestamps
Not compromised, according to Vercel:
- Environment variables marked “sensitive”
- Core platform infrastructure
The critical design detail: Vercel’s “sensitive” flag for environment variables defaulted to off. Secrets were only encrypted at rest when a developer explicitly opted in.
Why API developers should care
Every API depends on secrets:
- API keys
- OAuth tokens
- Database credentials
- Webhook signing keys
- Deployment tokens
- Session signing keys
The Vercel breach did not target an API endpoint directly. It targeted the infrastructure where API credentials live.
That is the part most teams need to audit.
Lesson 1: Encrypt secrets at rest, not only in transit
HTTPS protects API credentials while they move across the network. It does not protect credentials sitting in a deployment platform, CI/CD system, or configuration store.
In this incident, the attacker did not need to intercept traffic. They accessed stored environment variables.
What to do this week
-
Move credentials into a secrets manager:
- HashiCorp Vault
- AWS Secrets Manager
- Azure Key Vault
-
Verify your deployment platform’s defaults:
- Are environment variables encrypted at rest by default?
- Is encryption opt-in?
- Can developers create unencrypted variables?
-
Separate configuration from secrets:
- Non-secret config can stay in environment variables.
- Credentials should live in a vault.
Example split:
# Configuration: non-secret
LOG_LEVEL=info
REGION=us-east-1
FEATURE_FLAG_NEW_UI=true
# Credentials: always encrypted at rest
SECRET_DATABASE_URL=postgresql://...
SECRET_API_KEY=sk-...
SECRET_WEBHOOK_SIGNING_KEY=whsec_...
How Apidog fits
Apidog integrates with HashiCorp Vault, Azure Key Vault, and AWS Secrets Manager. When testing APIs that require authentication, credentials can be pulled from the vault at runtime instead of being stored in plaintext project files or shared configuration.
That lets teams share API test definitions without sharing raw secrets.
Lesson 2: Audit OAuth grants from AI dev tools
The breach started with one OAuth grant to an AI tool.
Context.ai was a legitimate tool, not an obviously suspicious app. But once it was compromised, its OAuth access became an entry point.
Modern development teams commonly connect tools such as:
- AI coding assistants
- AI observability tools
- GitHub integrations
- Automation agents
- Internal workflow tools
Each OAuth grant expands your attack surface.
OAuth audit checklist
Audit these systems first:
- Google Workspace
- GitHub
- GitLab
- Slack
- Identity provider
- Cloud provider console
- CI/CD platform
For each connected app, ask:
- Who installed it?
- When was it last used?
- What scopes does it have?
- Does it have admin access?
- Does it still serve a business purpose?
- Can permissions be reduced?
If you do not recognize the app, revoke it.
Set a recurring process
OAuth grants accumulate silently. A tool tested for one day can retain access for months.
Use a quarterly review cycle:
Every quarter:
1. Export third-party OAuth applications.
2. Identify unused or unknown apps.
3. Revoke stale grants.
4. Reduce scopes where possible.
5. Document approved tools and owners.
Apply least privilege
When granting OAuth access:
- Prefer read-only scopes.
- Avoid workspace-wide permissions.
- Avoid admin scopes unless required.
- Use separate service accounts where possible.
- Require review for tools that access source code, secrets, logs, or customer data.
Lesson 3: Treat all environment variables as sensitive by default
Vercel’s sensitive flag was opt-in. That meant developers had to know which variables needed protection and remember to enable it.
That model is fragile.
Security controls should be enabled by default.
What to do
Classify every environment variable into one of two categories:
| Type | Examples | Required handling |
|---|---|---|
| Configuration |
LOG_LEVEL, REGION, FEATURE_FLAG_NEW_UI
|
Standard environment variable |
| Credential |
DATABASE_URL, API_KEY, TOKEN, PASSWORD, WEBHOOK_SECRET
|
Encrypt at rest |
Use naming conventions so secrets are easy to detect:
SECRET_DATABASE_URL=postgresql://...
SECRET_API_KEY=sk-...
SECRET_OAUTH_CLIENT_SECRET=...
SECRET_WEBHOOK_SIGNING_KEY=...
Add a CI check
Block deployments when suspicious environment variable names are not marked as sensitive.
Example logic:
const secretPatterns = [
/KEY/i,
/SECRET/i,
/TOKEN/i,
/PASSWORD/i,
/CREDENTIAL/i,
/DATABASE_URL/i,
];
function looksLikeSecret(name) {
return secretPatterns.some((pattern) => pattern.test(name));
}
function validateEnvVars(envVars) {
const failures = [];
for (const envVar of envVars) {
if (looksLikeSecret(envVar.name) && !envVar.sensitive) {
failures.push(envVar.name);
}
}
if (failures.length > 0) {
throw new Error(
`Environment variables must be marked sensitive: ${failures.join(", ")}`
);
}
}
The implementation depends on your platform, but the rule is simple: anything that looks like a credential should be encrypted by default.
Lesson 4: Automate credential rotation
After disclosure, Vercel recommended that customers rotate all affected non-sensitive environment variables.
For teams with dozens of services and hundreds of keys, manual rotation is slow and error-prone.
The teams that recover fastest are the ones that already have rotation scripts, owners, and tests.
What to do
-
Set expiration windows:
- Standard API keys: 90 days or less
- High-risk credentials: 30 days or less
- Temporary CI credentials: expire after the build
-
Use your secrets manager’s rotation features:
- AWS Secrets Manager rotation
- HashiCorp Vault dynamic secrets
- Azure Key Vault lifecycle management
-
Build rotation into deployment:
- Generate new credential
- Store in secrets manager
- Deploy using new credential
- Validate traffic
- Revoke old credential
Run rotation drills quarterly.
Rotation order during an incident
Rotate credentials in this order:
- Database credentials
- Payment processor API keys
- Cloud provider credentials
- OAuth client secrets
- Webhook signing keys
- Deployment tokens
- Session signing keys
- Lower-risk third-party API keys
Use this order because database, payment, and cloud credentials usually have the highest blast radius.
Lesson 5: Secure your CI/CD pipeline as an API attack surface
Your CI/CD pipeline often has access to:
- Source code
- Deployment targets
- Production credentials
- API keys
- Cloud accounts
- Artifact registries
That makes it a high-value API attack surface.
What to do
Scope secrets to specific jobs
Do not expose production secrets to every pipeline job.
Bad pattern:
env:
PROD_DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}
PROD_API_KEY: ${{ secrets.PROD_API_KEY }}
Better pattern:
jobs:
deploy:
environment: production
steps:
- name: Deploy
env:
PROD_DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}
run: ./deploy.sh
Use short-lived credentials
Prefer OIDC or temporary credentials over long-lived API keys.
GitHub Actions supports OIDC for AWS, Azure, and GCP. This lets your workflow request short-lived cloud credentials during the build instead of storing permanent cloud keys in CI secrets.
Pin CI dependencies
Mutable tags can change. Pin actions to commit SHAs.
# Bad: mutable tag
- uses: actions/checkout@v4
# Better: pinned to a specific commit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
Use ephemeral runners
Persistent build runners accumulate state. Prefer runners that are destroyed after each build.
Audit secret access
Review:
- Which jobs accessed secrets
- Which users triggered those jobs
- Whether the accessed secrets match expected job behavior
- Whether any unusual build ran during the exposure window
How Apidog fits into CI/CD security
Apidog’s CLI can run API tests in CI/CD pipelines without embedding credentials directly in pipeline configuration. Credentials can be pulled from a vault at runtime, used for test execution, and discarded after the job completes.
Lesson 6: Build APIs with security-on-by-default
The Vercel incident highlights a broader API design principle:
Secure defaults should be enabled automatically. Developers should explicitly opt out only when needed.
Apply that principle to your APIs.
Default API security checklist
For every new endpoint:
- Require authentication by default.
- Require authorization checks.
- Enable rate limiting.
- Validate request body, query params, and path params.
- Return minimal error responses.
- Log authentication and authorization events.
- Avoid exposing stack traces.
- Document any public endpoint explicitly.
Example endpoint policy
default_security:
authentication: required
authorization: required
rate_limit: 100 requests/minute
input_validation: strict
error_detail: minimal
audit_logging: enabled
Error response example
Bad:
{
"error": "DatabaseError",
"message": "relation users_private does not exist",
"host": "10.0.4.12",
"stack": "..."
}
Better:
{
"error": "Internal server error",
"requestId": "req_abc123"
}
Keep internal details in logs, not API responses.
Security scheme design in Apidog
Apidog supports 13 authentication methods, including:
- OAuth 2.0
- JWT
- mTLS
- API Key
- Hawk authentication
You can define security schemes at the project level and inherit them across endpoints. That makes authentication the default for new endpoints. If an endpoint should be public, you explicitly remove the security scheme.
Apidog also lets you test authentication methods directly, including mutual TLS with custom client certificates and CA certificates. This helps catch auth misconfigurations before deployment.
Lesson 7: Build an incident response playbook before you need one
Many teams know they should rotate credentials after a breach. Fewer teams know exactly:
- Which credentials to rotate first
- Who owns each credential
- Which logs to review
- How to detect unauthorized API usage
- What to tell customers
- How to validate that rotation worked
Write the playbook before the incident.
API credential incident response playbook
Phase 1: Contain — first 30 minutes
- Identify potentially exposed credentials.
- Rotate highest-risk credentials first.
- Enable enhanced API logging.
- Block known malicious IPs or tokens if available.
- Freeze risky deploys until the blast radius is understood.
Phase 2: Assess — first 4 hours
- Review API access logs for the exposure window.
- Identify unauthorized API calls.
- Look for unusual query volume.
- Check for large responses or bulk exports.
- Review access to sensitive endpoints.
- Document what was accessed and what was not.
Phase 3: Remediate — first 24 hours
- Rotate all remaining credentials.
- Revoke active sessions if needed.
- Revoke stale OAuth grants.
- Update firewall rules and IP allowlists.
- Patch the vulnerability or remove the exposed integration.
- Validate that old credentials no longer work.
Phase 4: Communicate — within 48 hours
- Notify affected customers.
- Explain what was exposed.
- Explain what was not exposed.
- Provide rotation instructions for API consumers.
- Publish a timeline and remediation summary.
- Update security documentation.
Test the playbook
Use API tests to validate your controls:
- Expired tokens return
401. - Rotated API keys stop working immediately.
- New API keys work after rotation.
- Rate limits trigger during brute-force attempts.
- Error responses do not leak internal information.
- Revoked OAuth tokens cannot access protected endpoints.
Apidog test scenarios can automate these checks and run them in CI/CD after credential rotation.
Real-world use cases
Fintech API platform
A payment processing startup rotated 340 API keys within 3 hours of the Vercel disclosure. They had pre-built rotation scripts tied to AWS Secrets Manager. Their API tests in Apidog verified that each rotated key worked before production traffic switched over. They avoided downtime.
SaaS collaboration tool
A team building a project management API discovered 17 unencrypted environment variables on Vercel after the breach disclosure. They migrated credentials to HashiCorp Vault, set up Apidog test scenarios to validate each auth method after rotation, and added a CI check to block deploys with unencrypted secrets.
E-commerce API gateway
An e-commerce platform audited OAuth grants and found 12 AI tools with access to their GitHub organization. Eight had not been used in more than 6 months. They revoked unused grants and implemented a quarterly OAuth audit.
Conclusion
The Vercel breach was not exotic. It exploited common API development patterns:
- Plaintext secrets
- Accumulated OAuth grants
- Opt-in security controls
- CI/CD systems with broad access
- Third-party tools connected to developer workspaces
The practical takeaways:
- Encrypt all secrets at rest.
- Audit OAuth grants, especially AI developer tools.
- Treat credentials as sensitive by default.
- Automate credential rotation.
- Treat CI/CD as an attack surface.
- Build APIs with authentication enabled by default.
- Write and test an incident response playbook.
Your API credentials are only as secure as the weakest tool in your development chain. That weak link might be a small AI tool connected months ago and forgotten.
Start by auditing secrets, OAuth grants, and CI/CD access this week. Then test your authentication methods, credential rotation, and failure cases before an attacker does.
FAQ
What was the Vercel April 2026 security incident?
Attackers compromised a third-party AI tool called Context.ai’s OAuth application, used it to take over a Vercel employee’s Google Workspace account, and accessed customer environment variables that were not encrypted at rest. The breach was disclosed on April 19, 2026.
Were Vercel customer API keys exposed?
Customer environment variables not marked as “sensitive” were exposed. This included API keys, database credentials, and deployment tokens stored without encryption at rest. Variables explicitly marked “sensitive” were not compromised.
How do I check if my Vercel environment variables are encrypted?
In the Vercel dashboard, go to Project Settings > Environment Variables. Variables marked as “Sensitive” are encrypted at rest. Any variable without this flag should be treated as exposed if you were affected and rotated immediately.
What is the best way to store API keys securely?
Use a dedicated secrets manager such as HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault. These tools encrypt secrets at rest, support rotation workflows, and provide audit logs. Avoid storing API keys in plaintext environment variables, git repositories, or local configuration files.
How often should I rotate API keys?
Rotate API keys at least every 90 days. For high-risk credentials such as database passwords and payment processor keys, rotate every 30 days. After any security incident affecting your infrastructure or a platform you depend on, rotate affected credentials immediately.
What is an OAuth supply chain attack?
An OAuth supply chain attack targets a third-party application that already has OAuth access to your systems. Instead of attacking you directly, the attacker compromises the third-party app and uses its existing permissions to access your data.
How does Apidog help with API security testing?
Apidog supports 13 authentication methods, integrates with major secrets managers such as HashiCorp Vault, Azure Key Vault, and AWS Secrets Manager, and lets teams run security-focused API test scenarios. You can test token expiration, credential rotation, rate limiting, and error response behavior in automated test suites.
What should I do first after an API credential breach?
Rotate the highest-risk credentials first: database passwords, payment processor API keys, cloud credentials, and OAuth client secrets. Then enable enhanced logging, review API access logs for the exposure window, and follow your incident response playbook.
Top comments (0)