The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(profiles): drop nested credential stores from the default-profile export too
kshitijk4poor39b99be19bf3
diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.pyindex a8768e24591..655a9d20cc6 100644--- a/hermes_cli/profiles.py+++ b/hermes_cli/profiles.py@@ -2228,9 +2228,10 @@ def _default_export_ignore(root_dir: Path):"""def _ignore(directory: str, contents: list) -> set:- # Universal exclusions (any depth) plus npm lockfiles that can appear at root.+ # Universal exclusions and credential names (any depth) plus npm lockfiles that can appear at root.ignored = _non_exportable_entries(directory, contents)ignored.update({"package.json", "package-lock.json"} & set(contents))+ ignored.update(_EXPORT_CREDENTIAL_FILES & set(contents))if Path(directory) == root_dir:ignored.update(entry for entry in contents if entry not in _DEFAULT_EXPORT_INCLUDE_ROOT)return ignored@@ -2238,7 +2239,7 @@ def _default_export_ignore(root_dir: Path):return _ignore-# Credential names dropped at ANY depth of a named-profile export, on top of the root-relative+# Credential names dropped at ANY depth of every profile export, on top of the root-relative# PROFILE_CREDENTIAL_PATHS. ``bot-desktop`` is the screen's runtime state:# its persistent Chromium profile (Cookies, Login Data — the bot's live web sessions), Xauthority, sockets.# The OS stores are dropped wherever they sit (a skill dir copied from a home carries its ``.ssh``).diff --git a/tests/hermes_cli/test_profile_export_credentials.py b/tests/hermes_cli/test_profile_export_credentials.pyindex bf00b8ea01d..d263b64127e 100644--- a/tests/hermes_cli/test_profile_export_credentials.py+++ b/tests/hermes_cli/test_profile_export_credentials.py@@ -127,14 +127,18 @@ class TestCredentialExclusion:with tarfile.open(export_profile("testprofile", str(tmp_path / "export.tar.gz")), "r:gz") as tf:members = {m.name: m for m in tf.getmembers()}note = tf.extractfile("testprofile/config.yaml.bak-my-note").read().decode()+ # The default profile's root allow-list keeps skills/, so its nested copies need the same drop.+ with tarfile.open(export_profile("default", str(tmp_path / "default.tar.gz")), "r:gz") as tf:+ default_members = set(tf.getnames())assert {"testprofile/config.yaml", "testprofile/platforms/keep.json"} <= set(members)+ assert "default/config.yaml" in default_membersassert _LEAKED_KEY not in noterels = {*_EXTRA_STORES, *PROFILE_CREDENTIAL_PATHS, "google_chat_user_tokens/upper.json", *nested,*(c.relative_to(profile_dir).as_posix() for c in copies)}- folded = {n.casefold() for n in members}- leaked = sorted(r for r in rels if any(- n == f"testprofile/{r}".casefold() or n.startswith(f"testprofile/{r}/".casefold()) for n in folded))+ folded = {n.casefold() for n in (*members, *default_members)}+ leaked = sorted(f"{p}/{r}" for p in ("testprofile", "default") for r in rels if any(+ n == f"{p}/{r}".casefold() or n.startswith(f"{p}/{r}/".casefold()) for n in folded))assert not leaked, leaked@pytest.mark.parametrize("declare_owned", [False, True])