Skip to content

fix(security): extend secret redaction to ElevenLabs, Tavily and Exa API keys#3790

Open
memosr wants to merge 1 commit intoNousResearch:mainfrom
memosr:fix/redact-missing-provider-keys
Open

fix(security): extend secret redaction to ElevenLabs, Tavily and Exa API keys#3790
memosr wants to merge 1 commit intoNousResearch:mainfrom
memosr:fix/redact-missing-provider-keys

Conversation

@memosr
Copy link
Copy Markdown
Contributor

@memosr memosr commented Mar 29, 2026

What does this PR do?

Three provider API keys used by Hermes were leaking in plain text to
logs and tool output because their prefixes were missing from
_PREFIX_PATTERNS in agent/redact.py.

ElevenLabs TTS keys start with sk_ (underscore). The existing
pattern only covers sk- (dash). One character difference — completely
missed.

Tavily search keys use a tvly- prefix. No pattern existed.

Exa search keys use an exa_ prefix. No pattern existed.

All three providers are actively used by Hermes (TTS, web search).
Running printenv or any command that dumps environment variables would
expose these keys in full.

Related Issue

No existing issue — this is a proactive security fix.

Type of Change

  • 🔒 Security fix

Changes Made

  • agent/redact.py:

    • Added r"sk_[A-Za-z0-9_]{10,}" — ElevenLabs TTS key
    • Added r"tvly-[A-Za-z0-9]{10,}" — Tavily search API key
    • Added r"exa_[A-Za-z0-9]{10,}" — Exa search API key
  • tests/agent/test_redact.py:

    • Added TestMissingProviderKeys class with new test cases
    • Covers inline log lines and env dump format

How to Test

Checklist

  • Read the Contributing Guide
  • Commit messages follow Conventional Commits
  • No duplicate PR found
  • PR contains only this security fix
  • pytest passes
  • Tests added for the fix
  • Tested on: Ubuntu 24.04
  • Cross-platform: pure regex, no OS calls — N/A

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