# Together AI: Together AI: An AI coding agent committed a secret to public GitHub and leaked customer prompts

> **Safety notice:** Run only inside your own local development repositories and sandboxes.

- **Incident date:** Jun 24–Jul 14, 2026
- **Disclosed:** Nov 21, 2026
- **Source disclosure:** https://www.together.ai/blog/security-event-prompt-leakage-for-requests-in-june-and-july-of-2026

## Reproduction lab
Verifies locally that your AI coding agent shell does not inherit ambient Hugging Face tokens and that your .pre-commit-config.yaml includes a real token scanner instead of PEM-only checks.

```bash
# Confirm no persistent Hugging Face token file sits in an AI coding agent workspace
test ! -f "$HOME/.cache/huggingface/token" && echo "PASS: no cached HF token"

# Verify .pre-commit-config.yaml includes token scanning (not just PEM detect-private-key)
grep -qE 'gitleaks|trufflehog|detect-secrets' .pre-commit-config.yaml \
  && echo "PASS: token scanner configured" || echo "WARN: add gitleaks or trufflehog hook"
```

## Policies and detection rules

### `block-agent-secret-commits.yaml`
Replaces PEM-only pre-commit checks with gitleaks secret scanning on both push and pull_request, catching Hugging Face tokens (hf_) before code ever leaves a workstation or lands on main. Limits steps 1 and 2.

```yaml
# .github/workflows/secret-gate.yml
name: Block Credentials on PR and Push
on:
  pull_request:
  push:
jobs:
  gitleaks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Scan commits for HF and cloud tokens
        uses: gitleaks/gitleaks-action@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Pair with GitHub Push Protection (org-wide, blocking) and run AI coding agents
# inside containers with HF_TOKEN, AWS_SECRET_ACCESS_KEY, and ~/.cache/huggingface unset.
```

### `audit-agent-env-and-zdr.sh`
Checks local developer or AI-agent sandboxes for ambient Hugging Face tokens before running autonomous edits and verifies pre-commit does not rely solely on PEM-only detect-private-key. Limits steps 1 and 3.

```sh
#!/usr/bin/env bash
set -euo pipefail

# 1. Fail if ambient dataset/model tokens are exposed in an AI coding agent shell
for var in HF_TOKEN HUGGING_FACE_HUB_TOKEN TOGETHER_API_KEY AWS_SECRET_ACCESS_KEY; do
  if [[ -n "${!var:-}" ]]; then
    echo "FAIL: $var is set in agent environment; unset before launching coding agents"
    exit 1
  fi
done
if [[ -f "${HOME}/.cache/huggingface/token" ]]; then
  echo "FAIL: persistent Hugging Face token file exists at ~/.cache/huggingface/token"
  exit 1
fi
if [[ -f .pre-commit-config.yaml ]] && ! grep -qE 'gitleaks|trufflehog|detect-secrets' .pre-commit-config.yaml; then
  echo "WARN: .pre-commit-config.yaml lacks a token/entropy scanner (detect-private-key only catches PEM headers)"
fi
echo "PASS: no ambient Hugging Face or inference keys found in agent sandbox"
```

## Indicators of compromise
- **url:** `https://www.together.ai/blog/security-event-prompt-leakage-for-requests-in-june-and-july-of-2026` (Official November 21, 2026 security notice by Together AI CEO Vipul Ved Prakash detailing the AI coding agent commit on xorl, affected models and dates, and five Dragos canary tokens.)
- **url:** `https://github.com/togethercomputer/xorl/blob/main/.pre-commit-config.yaml` (Public xorl pre-commit configuration inspected Dec 4 showing PEM-only detect-private-key and custom check_public_tree.py without API-token scanning.)
- **url:** `https://github.com/togethercomputer/xorl/blob/main/scripts/check_public_tree.py` (Public xorl internal-reference scrubber explicitly blocking /shared/huggingface and AI assistant strings (claude, anthropic, copilot) while omitting credential-prefix rules.)
- **url:** `https://www.dragos.com/blog/ai-supply-chain-security-canary-tokens` (November 19, 2026 Dragos canary-token study documenting attacker validation of stolen AWS keys, S3 listing, and Secrets Manager enumeration from leaked inference prompts.)
