Stripe Key Leaked on GitHub? Rotate It Immediately and Follow These Steps
Accidentally pushing a Stripe secret key to a GitHub repository requires immediate action, starting with rotating the key in the Stripe dashboard set to expire 'Now' — not after a grace period. Simply deleting the file is insufficient, as the key remains accessible in the repository's full commit history and must be scrubbed using tools like git filter-repo or BFG Repo-Cleaner. After rotating, developers should redeploy with the new key, then audit Stripe's API request logs for any unauthorized activity such as unrecognized IPs, unexpected refunds, or customer data queries. GitHub's secret scanning program can automatically alert Stripe when a live key is detected in a public repository, but this is not instantaneous and should not be relied upon as a first response. Going forward, best practices include using restricted API keys, adding .env files to .gitignore before the first commit, and scanning for secrets locally before pushing.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in