The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: control socket mints tickets for a symlinked HERMES_HOME
Teknium4c9a532320e7
diff --git a/gateway/control_socket.py b/gateway/control_socket.pyindex 2eb1b798d46..d001237e72b 100644--- a/gateway/control_socket.py+++ b/gateway/control_socket.py@@ -131,7 +131,9 @@ class GatewayControlServer:if home is None:from gateway.status import _get_process_hermes_homehome = _get_process_hermes_home()- self._home = Path(home)+ # The real directory, as clients canonicalize it: the peer check below refuses any+ # symlinked component, so an unresolved symlinked ~/.hermes would never mint tickets.+ self._home = Path(home).resolve()self.ticket_store = Noneself.private_handlers = {}self._server: Optional[asyncio.AbstractServer] = Nonediff --git a/tests/gateway/test_control_socket_peer_security.py b/tests/gateway/test_control_socket_peer_security.pynew file mode 100644index 00000000000..34faf270dc5--- /dev/null+++ b/tests/gateway/test_control_socket_peer_security.py@@ -0,0 +1,20 @@+"""Control-socket trust boundary: server identity, home writability, pointer mode, fallback root."""+import os+import socket++import pytest++pytestmark = pytest.mark.platforms("linux") # SO_PEERCRED / POSIX ACL / AF_UNIX semantics+++def test_symlinked_home_still_authenticates_same_uid_peers(tmp_path):+ from gateway.control_socket import GatewayControlServer+ real = tmp_path / "real"+ real.mkdir(mode=0o700)+ (tmp_path / "link").symlink_to(real)+ ours, _theirs = socket.socketpair(socket.AF_UNIX)++ class Writer:+ def get_extra_info(self, _key):+ return ours+ assert GatewayControlServer(tmp_path / "link")._posix_peer_subject(Writer()) == f"uid:{os.getuid()}"