Guide · November 23, 2026

Your AI coding agent committed a secret: block it before push, and rotate if it got out

On Nov 21, 2026, Together AI disclosed that an AI coding agent working on its public GitHub repo xorl committed a credential for a private Hugging Face repository. Together's automated scanning caught it and the commit was reverted. But during that window someone took the credential, downloaded stored customer prompt samples from the private repo, searched them for other services' credentials and tested those. (Together AI incident post)

The lesson: a scanner that alerts after the push, plus a revert, isn't enough. Once a key is in a public commit, assume it's been copied. Block secrets before they leave your machine, and rotate anything that got out.

Why agents make this more likely

1. Block secrets at commit time, for humans and agents

A git hook runs whoever makes the commit, including an agent in your terminal. With gitleaks installed:

# .git/hooks/pre-commit  (chmod +x it)
#!/bin/sh
gitleaks git --pre-commit --staged --redact --verbose || {
  echo "Secret found in staged changes. Remove it, then commit again."; exit 1; }

To share it with your team, use the pre-commit framework with the gitleaks hook, or add the same check to a pre-push hook. Tell your agent in AGENTS.md / CLAUDE.md never to bypass hooks with --no-verify. Hooks only cover the machine they're installed on, so add the server-side check below too.

2. Turn on GitHub push protection

GitHub's push protection blocks a push that contains a detected secret, before it reaches the repo. Push protection for users is on by default and covers pushes to public repositories. Push protection for repositories is off by default: a repo admin turns it on in the repo's security settings (it needs GitHub Secret Protection). Turn it on for repos your agents push to.

Keep a CI scan as a backstop (for example gitleaks in GitHub Actions on every pull request), since push protection only catches the secret types it recognizes. Together AI says it now checks every pull request for credentials.

3. If a key already got out: rotate, don't revert

  1. Rotate the key at the provider first. Reverting the commit, force-pushing or deleting the branch doesn't help, because anyone who saw it already has it.
  2. Check what the key could reach and look at the provider's access logs for use you don't recognize.
  3. Look for other secrets in your history: gitleaks git --redact -v scans every commit, not just the latest one.
  4. Follow the chain. In Together's case the first key unlocked data that held more credentials. If a store your key opened could contain keys, prompts or logs, rotate those too.

Our exposed .env guide has a rotation order that keeps the app running while you swap keys.

4. Limit what a leaked key can do

Shipped something with an AI agent? Run the free live-site check to see whether your live app leaks keys in its JavaScript or serves a .env or .git folder. The paid repo report also scans your full git history for secrets.

The VibePreflight team