mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
fix(redact): cover fireworks token prefixes
This commit is contained in:
parent
e670d9cdd6
commit
2b58febe46
2 changed files with 18 additions and 0 deletions
|
|
@ -107,7 +107,9 @@ _PREFIX_PATTERNS = [
|
|||
r"brv_[A-Za-z0-9]{10,}", # ByteRover API key
|
||||
r"xai-[A-Za-z0-9]{30,}", # xAI (Grok) API key
|
||||
r"ntn_[A-Za-z0-9]{10,}", # Notion internal integration token
|
||||
r"fw-[A-Za-z0-9]{30,}", # Fireworks AI API key
|
||||
r"fw_[A-Za-z0-9]{30,}", # Fireworks AI API key
|
||||
r"fpk_[A-Za-z0-9]{30,}", # Fireworks AI project key
|
||||
]
|
||||
|
||||
# ENV assignment patterns: KEY=value where KEY contains a secret-like name.
|
||||
|
|
|
|||
|
|
@ -59,6 +59,22 @@ class TestKnownPrefixes:
|
|||
result = redact_sensitive_text("fal_abc123def456ghi789jkl")
|
||||
assert "abc123def456" not in result
|
||||
|
||||
def test_fireworks_keys(self):
|
||||
samples = [
|
||||
"fw-" + "A" * 40,
|
||||
"fw_" + "B" * 40,
|
||||
"fpk_" + "C" * 40,
|
||||
]
|
||||
|
||||
for token in samples:
|
||||
result = redact_sensitive_text(f"provider error {token}")
|
||||
assert token not in result
|
||||
assert "..." in result
|
||||
|
||||
def test_short_fireworks_like_words_unchanged(self):
|
||||
text = "fw-tooshort fw_tooshort fpk_tooshort"
|
||||
assert redact_sensitive_text(text) == text
|
||||
|
||||
def test_notion_internal_integration_token(self):
|
||||
result = redact_sensitive_text("ntn_abc123def456ghi789jkl")
|
||||
assert "abc123def456" not in result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue