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>
This commit is contained in:
yucheng 2026-09-11 22:36:01 +00:00
parent 81050b4177
commit 2b07fd29d6
2 changed files with 3 additions and 1 deletions

View file

@ -455,7 +455,7 @@ _SHELL_ASSIGNMENT: Final = re.compile(r"(?P<key>[^\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"

View file

@ -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):