Skip to content

The agent that grows with you

fix(profiles): keep every credential store out of profile exports

John Paul Soliva9c18f8c28ce2
diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.py
index af834097d34..9a81cddb98a 100644
--- a/hermes_cli/profiles.py
+++ b/hermes_cli/profiles.py
@@ -148,6 +148,26 @@ def _clone_all_copytree_ignore(source_dir: Path):
return _ignore
+# Credential stores Hermes reads from a profile home, as paths relative to it. Never shipped in a
+# profile export, and user-owned (never overwritten) on a distribution install. Add a store here
+# when a loader starts reading one.
+PROFILE_CREDENTIAL_PATHS = frozenset({
+ "auth.json", ".env", "auth/google_oauth.json",
+ ".op.env", # 1Password service-account token (env_loader)
+ "npmrc", # npm registry auth (source_build)
+ ".anthropic_oauth.json", # Anthropic OAuth tokens (credential_sources)
+ "google_token.json", "google_oauth_pending.json", "google_client_secret.json",
+ "google_chat_user_tokens", "google_chat_user_client_secret.json", "google_chat_user_oauth_pending.json",
+ "slack_tokens.json",
+ "webhook_subscriptions.json", # per-route HMAC secrets
+ "mcp-tokens", # MCP OAuth tokens
+ "vault", # vault.key + vault.json.enc
+ "browser-profile", "browser_auth", "bot-desktop", # browser cookies / logins
+ "pairing", "platforms/pairing",
+ "whatsapp/session", "platforms/whatsapp/session", "matrix/store", "platforms/matrix/store",
+ "cache/bws_cache.json", "cache/bws_cache.enc.json",
+})
+
# Directories/files to exclude when exporting the default (~/.hermes) profile.
# The default profile contains infrastructure (repo checkout, worktrees, DBs,
# caches, binaries) that named profiles don't have. We exclude those so the
@@ -181,7 +201,7 @@ _DEFAULT_EXPORT_EXCLUDE_ROOT = DEFAULT_EXPORT_EXCLUDE_ROOT = frozenset({
"browser_screenshots", "checkpoints",
"sandboxes",
"logs", # gateway logs
-}) | PM_RUNTIME_ROOT_DIRS
+}) | PM_RUNTIME_ROOT_DIRS | frozenset(p for p in PROFILE_CREDENTIAL_PATHS if "/" not in p)
# Allow-list for ``export_profile("default")``: when HERMES_HOME equals the
# cwd (Docker/custom deployments), the default profile home is the working
@@ -2175,7 +2195,8 @@ def _default_export_ignore(root_dir: Path):
return _ignore
-# Credential files dropped from named-profile exports. ``bot-desktop`` is the screen's runtime state:
+# Credential names dropped at ANY depth of a named-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.
_EXPORT_CREDENTIAL_FILES = frozenset({"auth.json", ".env", "bot-desktop"})
@@ -2237,6 +2258,8 @@ def export_profile(name: str, output_path: str, extra_files: Optional[Dict[str,
def _ignore_credentials(directory: str, contents: list) -> set:
ignored = _non_exportable_entries(directory, contents)
ignored.update(_EXPORT_CREDENTIAL_FILES & set(contents))
+ rel = Path(directory).relative_to(profile_dir)
+ ignored.update(e for e in contents if (rel / e).as_posix() in PROFILE_CREDENTIAL_PATHS)
if Path(directory) == profile_dir:
ignored |= PM_RUNTIME_ROOT_DIRS & set(contents)
return ignored
diff --git a/tests/hermes_cli/test_profile_export_credentials.py b/tests/hermes_cli/test_profile_export_credentials.py
index 7e67adf3fbc..39324d13445 100644
--- a/tests/hermes_cli/test_profile_export_credentials.py
+++ b/tests/hermes_cli/test_profile_export_credentials.py
@@ -55,6 +55,35 @@ class TestCredentialExclusion:
assert not any("auth.json" in n for n in names), "auth.json must NOT be in export"
assert not any(".env" in n for n in names), ".env must NOT be in export"
+ def test_export_ships_no_credential_store_a_loader_reads(self, tmp_path, monkeypatch):
+ """Every credential store Hermes loads from a profile home stays out of a named-profile
+ export and stays user-owned on a distribution install. .op.env (env_loader) and npmrc
+ (source_build) have no suffix the text scrub pass edits, so exclusion is their only guard."""
+ from hermes_cli.profile_distribution import USER_OWNED_EXCLUDE
+ from hermes_cli.profiles import PROFILE_CREDENTIAL_PATHS
+
+ profiles_root = tmp_path / "profiles"
+ profile_dir = profiles_root / "testprofile"
+ (profile_dir / "platforms").mkdir(parents=True)
+ (profile_dir / "config.yaml").write_text("model: gpt-4\n")
+ (profile_dir / "platforms" / "keep.json").write_text("{}")
+ stores = {".op.env", "npmrc", *PROFILE_CREDENTIAL_PATHS}
+ for rel in stores:
+ is_dir = "." not in rel.rsplit("/", 1)[-1] and rel != "npmrc" # token dirs vs single files
+ target = profile_dir / rel / "store" if is_dir else profile_dir / rel
+ target.parent.mkdir(parents=True, exist_ok=True)
+ target.write_text("fake-credential")
+ _patch_named_profile(monkeypatch, profiles_root, profile_dir)
+
+ with tarfile.open(export_profile("testprofile", str(tmp_path / "export.tar.gz")), "r:gz") as tf:
+ names = set(tf.getnames())
+
+ assert {"testprofile/config.yaml", "testprofile/platforms/keep.json"} <= names
+ leaked = sorted(r for r in stores if any(n == f"testprofile/{r}" or n.startswith(f"testprofile/{r}/") for n in names))
+ assert not leaked, leaked
+ root_stores = {r for r in stores if "/" not in r}
+ assert root_stores <= USER_OWNED_EXCLUDE, sorted(root_stores - USER_OWNED_EXCLUDE)
+
class TestExportSecretScrub:
diff --git a/website/docs/user-guide/profile-distributions.md b/website/docs/user-guide/profile-distributions.md
index 036f3b03edb..109d3219d29 100644
--- a/website/docs/user-guide/profile-distributions.md
+++ b/website/docs/user-guide/profile-distributions.md
@@ -87,7 +87,7 @@ Not a fit:
- **You want to hand someone your setup once, right now.** A distribution needs a repo, a manifest, and a `.gitignore`. `/export` needs none of that — see [Export and import a profile file](#export-and-import-a-profile-file). Same for backing up or moving a profile to a new machine.
- **You want to share your desktop theme and layout.** A distribution carries the agent — SOUL, config, skills, cron, MCP, plugins. An export made from the desktop app also carries the look: skin, light/dark mode, custom themes, rail color, and window layout.
-- **You want to share API keys alongside the agent.** `auth.json` and `.env` are deliberately excluded from distributions. Each installer brings their own credentials. (Export files strip them too.)
+- **You want to share API keys alongside the agent.** `auth.json`, `.env` and the other credential stores Hermes reads from a profile (`.op.env`, `npmrc`, OAuth token files, `mcp-tokens/`, `vault/`, browser profiles, platform sessions) are deliberately excluded from distributions. Each installer brings their own credentials. (Export files strip them too.)
- **You want to share memories / sessions / conversation history.** Those are user data, not distribution content. Never shipped. (Export files are different here — read [what an export contains](#what-an-export-file-contains) before sending one.)
:::caution
@@ -274,7 +274,7 @@ When an installer updates to a new version, some things get replaced (author's d
|---|---|---|
| **Distribution-owned** | `SOUL.md`, `config.yaml`, `mcp.json`, `skills/`, `cron/jobs.json`, `distribution.yaml` | Files are replaced from the new clone. Skill directories are merged per entry. `cron/jobs.json` is merged by job id: shipped definitions update in place, your local jobs and each job's paused/enabled state survive, and newly shipped jobs arrive paused. Other `cron/` files and root-level hidden `skills/` metadata are runtime state and stay local. |
| **Config override** | `config.yaml` | Actually preserved by default — the installer may have tuned model or provider. Pass `--force-config` on update to reset. |
-| **User-owned** | `memories/`, `sessions/`, `state.db*`, `auth.json`, `.env`, `logs/`, `workspace/`, `plans/`, `home/`, `*_cache/`, `local/` | Never touched |
+| **User-owned** | `memories/`, `sessions/`, `state.db*`, `auth.json`, `.env` and the other credential stores, `logs/`, `workspace/`, `plans/`, `home/`, `*_cache/`, `local/` | Never touched |
You can override the distribution-owned list in the manifest: