Stripe — Secret Key
Stripe secret keys provide full API access including charges, refunds, customer data, and payout management. Exposure is a critical financial and compliance risk.
Immediate Action Required
Deleting a leaked credential from a repository does not invalidate it. Assume it has already been copied. Follow the revocation steps below immediately, then investigate for unauthorized access.
What Is This Credential?
Stripe secret keys provide full API access including charges, refunds, customer data, and payout management. Exposure is a critical financial and compliance risk.
Permissions Granted
- Create and capture charges
- Issue refunds
- Access customer PII and payment methods
- Manage subscriptions and invoices
- Access payout and balance data
Exposure & Blast Radius
- Unauthorized charges to stored payment methods
- Fraudulent refunds to attacker-controlled accounts
- Exfiltration of customer PII and card metadata
- Subscription manipulation
- Financial loss and PCI DSS compliance implications
Immediate Response Steps
Roll the key immediately
Go to Stripe Dashboard → Developers → API keys → Roll the secret key. The old key is invalidated immediately.
Review recent API activity
Check Stripe Dashboard → Developers → Logs for unexpected API calls in the past 24–72 hours.
Check for unauthorized charges or refunds
Review Stripe Dashboard → Payments for any suspicious transactions.
Update all consumers with the new key
Update environment variables, secrets managers, and all services using the Stripe API.
Notify Stripe support if fraud occurred
Contact Stripe support immediately if unauthorized transactions are found.
Revocation vs Rotation
Revocation
Roll the key in Stripe Dashboard → Developers → API keys. Rolling immediately invalidates the old key and generates a new one atomically.
Rotation
Use the 'Roll key' function in the Stripe Dashboard. This is atomic — the new key is available immediately when the old one is invalidated.
Grace Period & Session Persistence
Grace Period
None. Rolling a Stripe secret key immediately invalidates the previous key.
Session Persistence
Stripe does not issue session tokens from secret keys. Each API call is independently authenticated. No session invalidation is needed beyond key revocation.
Investigation Checklist
- Review API request logs in Stripe Dashboard → Developers → Logs
- Check for charges with unusual amounts, frequencies, or customer IDs
- Look for refunds issued to unfamiliar bank accounts
- Review webhook endpoint configurations for unauthorized additions
- Check for new restricted keys or webhook secrets created
- Review customer data access patterns
Recovery Steps
- Update all environment variables with the new secret key
- Rotate webhook signing secrets if also exposed
- Review and dispute any fraudulent charges with Stripe
- Consider enabling Stripe Radar rules to flag suspicious activity
- Implement IP allowlisting for Stripe API calls if possible
Prevention
- Use restricted keys with only the permissions your application needs
- Store keys in a secrets manager (AWS Secrets Manager, Vault, etc.)
- Never expose secret keys in frontend JavaScript
- Use Stripe.js and Payment Intents to avoid handling raw card data
- Enable Stripe Radar for fraud detection
- Rotate keys periodically
Sources & Evidence
Always verify critical instructions with official provider documentation before taking action. Provider behavior may change without notice.
Found an issue with this playbook?
If these instructions are incorrect, outdated, or missing important information, please report it so we can improve the playbook.
Report an Issue on GitHub