The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: treat omitted empty systemd exec lists as verified service identity
Teknium9dddd057bec1
diff --git a/hermes_cli/gateway_runtime_service_identity.py b/hermes_cli/gateway_runtime_service_identity.pyindex 080ed017161..415bbf75b95 100644--- a/hermes_cli/gateway_runtime_service_identity.py+++ b/hermes_cli/gateway_runtime_service_identity.py@@ -18,6 +18,9 @@ SYSTEMD_IDENTITY_PROPERTIES = ("PassEnvironment", "UnsetEnvironment", "PAMName", "RootDirectory", "RootImage","ExecStartPre", "ExecCondition", "DropInPaths",)+# `systemctl show --all` (systemd 259) prints no line at all for these when the+# list is empty, so their absence carries no identity uncertainty.+SYSTEMD_OMITTED_WHEN_EMPTY = ("EnvironmentFiles", "ExecStartPre", "ExecCondition")def _unverified() -> NoReturn:@@ -106,6 +109,9 @@ def environment_pairs(value: str) -> dict[str, str]:def verify_systemd(props: dict[str, str], manager_env: str, home: Path, *, system: bool) -> None:import pwd+ # systemd 259 omits empty exec-command lists and EnvironmentFiles from+ # `show --all` output entirely; an omitted list is empty, not unknown.+ props = {**{key: "" for key in SYSTEMD_OMITTED_WHEN_EMPTY}, **props}if not all(key in props for key in SYSTEMD_IDENTITY_PROPERTIES):_unverified()# These can change the execution account, environment, mount namespace, ordiff --git a/tests/hermes_cli/test_gateway_runtime_service.py b/tests/hermes_cli/test_gateway_runtime_service.pyindex d0af0042a65..f7e8dfb885e 100644--- a/tests/hermes_cli/test_gateway_runtime_service.py+++ b/tests/hermes_cli/test_gateway_runtime_service.py@@ -15,6 +15,7 @@ import pytest("default", "deadline"),("wrong_home", "profile_mismatch"), ("wrong_user", "service_account_mismatch"),("missing_identity", "service_identity_unverified"),+ ("omitted_empty_exec_lists", "deadline"),("env_file", "service_identity_unverified"), ("dynamic_user", "service_identity_unverified"),("wrong_command", "service_identity_unverified"), ("command_profile", "profile_mismatch"),("dropin_home", "profile_mismatch"), ("manager_home", "profile_mismatch"),@@ -65,6 +66,11 @@ def test_ensure_checks_effective_service_binding_before_start(tmp_path, monkeypaprops['User'] = str(os.getuid() + 1)if case == "missing_identity":props = {k: props[k] for k in ("LoadState", "ActiveState", "SubState", "UnitFileState")}+ if case == "omitted_empty_exec_lists":+ # systemd >= 25x prints nothing for empty exec-command lists and+ # EnvironmentFiles even under --all; absence there means empty, not unknown.+ for key in ("ExecStartPre", "ExecCondition", "EnvironmentFiles"):+ del props[key]if case == "env_file":env_file = tmp_path / "override.env"env_file.write_text(f'HERMES_HOME={tmp_path / "other"}\n', encoding="utf-8")