The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(context-refs): derive the @file credential-dir block from HOME_CREDENTIAL_DIRS
kshitijk4poor625fab3fde51
diff --git a/agent/context_references.py b/agent/context_references.pyindex 894885b3b14..cd9243b89da 100644--- a/agent/context_references.py+++ b/agent/context_references.py@@ -15,6 +15,7 @@ from dataclasses import dataclass, fieldfrom pathlib import Pathfrom typing import Awaitable, Callable+from agent.file_safety import HOME_CREDENTIAL_DIRSfrom agent.model_metadata import CHARS_PER_TOKEN, estimate_tokens_roughfrom hermes_cli._subprocess_compat import IS_WINDOWS, harden_git_argv, noninteractive_git_env, windows_hide_flagsfrom hermes_cli.sqlite_safe_read import LiveConnectionError, offline_file_access@@ -90,7 +91,7 @@ _FILE_VALUE_PATTERN = re.compile(TRAILING_PUNCTUATION = ",.;!?"_OPENERS = {")": "(", "]": "[", "}": "{"}_NEEDS_QUOTING = re.compile(r"""[\s()\[\]{}<>"'`]""")-_SENSITIVE_HOME_DIRS = (".ssh", ".aws", ".gnupg", ".kube", ".docker", ".azure", ".config/gh")+_SENSITIVE_HOME_DIRS = HOME_CREDENTIAL_DIRS # one list with the write denylist and profile export_SENSITIVE_HERMES_DIRS = (Path("skills") / ".hub",)_SENSITIVE_HOME_FILES = tuple(Path(p) for p in (".ssh/authorized_keys", ".ssh/id_rsa", ".ssh/id_ed25519", ".ssh/config", ".bashrc", ".zshrc",diff --git a/tests/agent/test_context_references.py b/tests/agent/test_context_references.pyindex 8dd5e728f0e..a306d3de486 100644--- a/tests/agent/test_context_references.py+++ b/tests/agent/test_context_references.py@@ -603,13 +603,18 @@ async def test_blocks_canonical_read_denylist_credential_stores(tmp_path: Path,mcp_token.parent.mkdir(parents=True)mcp_token.write_text('{"token": "MCP-TOKEN-SECRET"}\n', encoding="utf-8")+ gcloud_adc = tmp_path / ".config" / "gcloud" / "application_default_credentials.json"+ gcloud_adc.parent.mkdir(parents=True)+ gcloud_adc.write_text('{"refresh_token": "GCLOUD-SECRET"}\n', encoding="utf-8")+project_env = tmp_path / "project" / ".env"project_env.parent.mkdir(parents=True)project_env.write_text("DB_PASSWORD=ENV-SECRET\n", encoding="utf-8")result = await preprocess_context_references_async("inspect @file:.hermes/auth.json and @file:.hermes/.anthropic_oauth.json "- "and @file:.hermes/mcp-tokens/github.json and @file:project/.env",+ "and @file:.hermes/mcp-tokens/github.json and @file:project/.env "+ "and @file:.config/gcloud/application_default_credentials.json",cwd=tmp_path,allowed_root=tmp_path,context_length=100_000,@@ -621,9 +626,10 @@ async def test_blocks_canonical_read_denylist_credential_stores(tmp_path: Path,"OAUTH-SECRET","MCP-TOKEN-SECRET","ENV-SECRET",+ "GCLOUD-SECRET",):assert secret not in result.message- assert sum("sensitive credential" in warning for warning in result.warnings) == 4+ assert sum("sensitive credential" in warning for warning in result.warnings) == 5@pytest.mark.asyncio