From 2b07fd29d60679787c7be899b9f2f87e54140d60 Mon Sep 17 00:00:00 2001 From: yucheng Date: Fri, 11 Sep 2026 22:36:01 +0000 Subject: [PATCH] fix(hide-secrets): stop reading a comparison operator as a trailing assignment Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../litellm_enterprise/enterprise_callbacks/secret_detection.py | 2 +- .../enterprise/enterprise_callbacks/test_secret_detection.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/enterprise/litellm_enterprise/enterprise_callbacks/secret_detection.py b/enterprise/litellm_enterprise/enterprise_callbacks/secret_detection.py index 8fee444c1d0..bd63d4f8baa 100644 --- a/enterprise/litellm_enterprise/enterprise_callbacks/secret_detection.py +++ b/enterprise/litellm_enterprise/enterprise_callbacks/secret_detection.py @@ -455,7 +455,7 @@ _SHELL_ASSIGNMENT: Final = re.compile(r"(?P[^\s\[#;:=](?:[^:=]*[^\s:=])?)=( _SHELL_OPERATORS: Final = ";&|" -_SHELL_TRAILER: Final = re.compile(r"\\|#.*|\S+=\S*") +_SHELL_TRAILER: Final = re.compile(r"\\|#.*|\w[\w.-]*=\S*") _SCAN_SUFFIX: Final = ".py" diff --git a/tests/test_litellm/enterprise/enterprise_callbacks/test_secret_detection.py b/tests/test_litellm/enterprise/enterprise_callbacks/test_secret_detection.py index 1e6e4255667..6d5dcb23547 100644 --- a/tests/test_litellm/enterprise/enterprise_callbacks/test_secret_detection.py +++ b/tests/test_litellm/enterprise/enterprise_callbacks/test_secret_detection.py @@ -265,6 +265,7 @@ def test_scan_message_redacts_every_credential_on_one_line(): "Translate this recipe note into French:\nsecret_sauce: Worcestershire sauce", "api_key = Massachusetts (the state, not a key)", "secret_sauce:Worcestershire sauce", + "password: correctHorseBattery != anotherValue", ], ids=[ "prose-password", @@ -322,6 +323,7 @@ def test_scan_message_redacts_every_credential_on_one_line(): "capitalized-word-starting-a-phrase", "capitalized-word-before-a-parenthetical", "yaml-scalar-without-a-space-after-the-colon", + "comparison-operator-after-the-value", ], ) def test_scan_message_keeps_benign_values(content):