Skip to content

gitignore: cover config/*.env, which the .json rule never did - #55

Merged
ThinkOffApp merged 1 commit into
mainfrom
fix/gitignore-config-env
Aug 4, 2026
Merged

gitignore: cover config/*.env, which the .json rule never did#55
ThinkOffApp merged 1 commit into
mainfrom
fix/gitignore-config-env

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

What

config/*.env and *.env added to .gitignore.

Why, and it is not hypothetical

Checking my own IAK checkout after @claudemm flagged local patches on the Mini, I found config/grok.env — untracked, unignored, holding a live key, in a clone of a repo that is public. One git add -A commits it. That is exactly the 2026-07-09 leak, which we already paid for once in a key rotation.

Neither existing rule covered it:

  • config/*.json is scoped to JSON. The .env file sat right beside the files that rule protects.
  • The bare .env rule matches a file named exactly .env. It does not match grok.env.

So the block whose own comment reads "Local machine configs hold live API keys - never commit" was protecting one extension in that directory and silently not the other.

The pattern, because we hit it twice today

This is the sibling trap. A rule gets written for one variant, the variant it was written against stays correct, and nobody checks the neighbour. The other instance today was in CodeWatch: thinkoff_green was corrected for the light theme and its near-twin thinkoff_green_light kept the dark value, shipping 21 call sites at 2.6:1 for weeks. Same shape, different file.

Worth a habit: when adding a protective rule, ask what else lives in the directory it protects.

Verified by execution, not by reading

$ git check-ignore -v config/grok.env
.gitignore:21:config/*.env	config/grok.env

Created the real filename in a worktree, confirmed the rule resolves to it, removed it again.

Why a PR and not a local exclude

I have already closed the hole on my own machine via .git/info/exclude, so nothing is urgent for me. But that fixes it for exactly one of us. Any user who drops a per-agent .env into config/ — which is the natural place to put it, next to the .json configs we tell them to put there — has the same exposure right now. Per the dogfood directive this belongs in the product with a working default, not in my checkout.

Not touched: the local modifications and stashes on the Mini that @claudemm flagged, and the ones on my own checkout (scripts/codex-webhook-supervisor.sh, a one-line diff, plus a WIP stash). Those need a look at what they actually do and are @Petrus's call — one of them backs a running process.

Found on the MacBook today: config/grok.env, untracked, unignored, holding
a live key, in a checkout of a PUBLIC repo. One `git add -A` away from the
same leak as 2026-07-09.

Neither existing rule covered it. `config/*.json` is scoped to JSON, and the
bare `.env` rule matches a file named exactly ".env" - not "grok.env". So the
directory whose own comment says "Local machine configs hold live API keys -
never commit" was protecting one file extension and silently not the other.

That is the sibling trap: a rule was written for one variant, the variant it
was written against stayed safe, and nobody checked whether its neighbour was
covered. Verified by execution rather than by reading - `git check-ignore -v`
resolves config/grok.env to this rule.

Product fix rather than a local one: any user who drops a per-agent .env into
config/ has the same exposure today, and a .git/info/exclude on my machine
would fix it for exactly one of us.
@cursor

cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@ThinkOffApp
ThinkOffApp merged commit 6dbee63 into main Aug 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant