litellm/ci_cd/TEST_KEY_PATTERNS.md
devin-ai-integration[bot] 837c6a7481
fix(security): remove the publicly known master key from the repo (#44718)
* fix(security): hash the publicly known master key

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* docs: replace weak master key examples and regenerate artifacts

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test: replace weak key fixtures with generated test keys

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* ci: generate master keys for proxy startup

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: preserve lens dev key entropy

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: restore proxy key compatibility in scrub examples

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: scrub merged SSO fixture and refresh dashboard bundle

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(ci): stabilize test keys and metadata collection

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore: drop the rebuilt dashboard bundle

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: mateo <mateo@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-06 10:55:24 -07:00

1.3 KiB

Test Key Patterns Standard

Standard patterns for test/mock keys and credentials in the LiteLLM codebase to avoid triggering secret detection.

How GitGuardian Works

GitGuardian uses machine learning and entropy analysis, not just pattern matching:

  • Low entropy values (like sk-test, postgres) are automatically ignored
  • High entropy values (realistic-looking secrets) trigger detection
  • Context-aware detection understands code syntax like os.environ["KEY"]

Option 1: Low Entropy Values (Simplest)

These won't trigger GitGuardian's ML detector:

api_key = "sk-test"
api_key = "sk-mock"
database_password = "postgres"
token = "test123"

Option 2: High Entropy with Test Prefixes

If you need realistic-looking test keys with high entropy, use these prefixes:

api_key = "sk-test-abc123def456ghi789..."  # OpenAI-style test key
api_key = "sk-mock-1234567890abcdef1234..."  # Mock key
api_key = "sk-fake-xyz789uvw456rst123..."  # Fake key
token = "test-api-key-with-high-entropy"

Configured Ignore Patterns

These patterns are in .gitguardian.yaml for high-entropy test keys:

  • sk-test-* - OpenAI-style test keys
  • sk-mock-* - Mock API keys
  • sk-fake-* - Fake API keys
  • test-api-key - Generic test tokens