Skip to content

Commit a08e9b3

Browse files
authored
Update test_tools_misc.py
1 parent 4d3f4ae commit a08e9b3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎tests/tools/test_tools_misc.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,11 @@ def test_printenv_does_not_reveal_secrets(self):
705705
with mock.patch.dict(os.environ, {**self.SECRETS, "SAFE_VAR": "visible"}):
706706
out = Bash().run({"command": "env"}, ToolContext(sess)).wait()
707707
self.assertIn("SAFE_VAR=visible", out)
708+
# compare names line-wise: a substring check would false-positive
709+
# on e.g. GITHUB_PATH when GITHUB_PAT is the secret
710+
names = {line.split("=", 1)[0] for line in out.splitlines() if "=" in line}
708711
for name, value in self.SECRETS.items():
709-
self.assertNotIn(name, out)
712+
self.assertNotIn(name, names)
710713
self.assertNotIn(value, out)
711714
# the harness's own environment is untouched
712715
self.assertNotIn("SAFE_VAR", os.environ)

0 commit comments

Comments
 (0)