Skip to content

The agent that grows with you

fix(redact): config.yaml backup copies under HERMES_HOME are secret-bearing too

teknium1f5907fd052d2
diff --git a/agent/redact.py b/agent/redact.py
index ea29cfc0397..7cf0a49daf7 100644
--- a/agent/redact.py
+++ b/agent/redact.py
@@ -1028,7 +1028,9 @@ def _is_secret_file_arg(arg: str) -> bool:
return False
if parts[-1] in _ENV_FILE_BASENAMES or parts[-1] in _SHELL_RC_BASENAMES:
return True
- if parts[-1] != "config.yaml":
+ # ``config.yaml`` plus the ``config.yaml.good.<stamp>`` / ``.corrupt.<stamp>`` copies Hermes
+ # writes under ``backups/config/`` — same contents, same secrets.
+ if parts[-1] != "config.yaml" and not parts[-1].startswith("config.yaml."):
return False
return hermes_home or ".hermes" in parts[:-1] or _is_under_hermes_home(path)
diff --git a/tests/agent/test_redact.py b/tests/agent/test_redact.py
index c90982ad550..ca402dcc63d 100644
--- a/tests/agent/test_redact.py
+++ b/tests/agent/test_redact.py
@@ -1291,6 +1291,7 @@ class TestHermesHomePathClassification:
monkeypatch.setattr(file_safety, "_hermes_root_path", lambda: home)
assert _is_secret_file_arg(str(home / "config.yaml"))
assert _is_secret_file_arg(str(home / "profiles" / "coder" / "config.yaml"))
+ assert _is_secret_file_arg(str(home / "backups" / "config" / "config.yaml.good.20260914-184559"))
assert not _is_secret_file_arg(str(tmp_path / "proj" / "config.yaml"))
assert not _is_secret_file_arg("config.yaml") # relative, not resolvable to the home