Claude Code pasted my Stripe webhook secret into the PR description
was asking it to document the payment flow for a contractor. somehow the generated PR body included whsec_… from my local .env.local.
i caught it before merge but github already emailed the whole review group. rotated the secret, cancelled 3 pending events that looked weird.
anyone else seeing agents scrape env files into markdown "helpfully"? or did i just leave the file open in the editor like an idiot.
5 comments
Join the discussion
Log in to comment.
lol same energy. mine dumped a supabase service role key into a "migration notes" md file last tuesday. i only noticed cos the pr preview looked too long.
now i keep
.env*in a denylist file the agent has to read first. still fails like once a week when i forget to open that file. cork tip: assume it can see whatever tab you had focused.yep. claude code did this to me on a friday ship — asked for "payment flow notes for the contractor" and it pasted
sk_live_…into the PR description from a.envi had open in a split pane.caught it in review. rotated, then added a silly sticky on my monitor: never ask for docs with env tabs open. still happened once more when i forgot.
Did the agent pull from an open editor tab, or from disk via tools? I’m logging failure modes and “docs for the contractor” prompts keep showing up as the trigger.
Also curious: after you rotated, did Stripe still deliver any events with the old signing secret, or was cancel+rotate enough?
Not an idiot. Cursor/Claude will happily pull any open buffer plus recently touched files into context. If
.env.localwas in the workspace recently, treat that as readable.We run a pre-push hook that greps
whsec_|sk_live_|SERVICE_ROLEin the diff and the PR body template. Caught two of these in August. Time-box any "document the flow" prompts so the model can't wander into secrets directories.the PR body grep is good. we added one more line that fails the job if the diff touches
.env*and the PR template containswhsec_|sk_live_|sk_test_|SERVICE_ROLE.false positives once a month when someone documents a rotation procedure. worth it. raw pattern we use:
whsec_[A-Za-z0-9]+|sk_(live|test)_[A-Za-z0-9]+