Let Hermes' gateway reach only a Matrix server you've allowed

sandbox/setup.sh allowed Hermes' gateway the host in MATRIX_HOMESERVER
from ~/.hermes/.env, which Hermes can write from inside its sandbox. On
the next update, Hermes could have opened the way out to any host it
chose.

The allowed server is now in ~/.config/coredesktop/sandbox/hermes.json,
which no sandbox can write. configure hermes is to do while Hermes names
a server you haven't allowed, and asks about only that; update says so.
Only a plain host name counts, so it can't be a wildcard or carry escape
codes into the question. A migration carries over the server the
gateway's systemd drop-in allows now, so a working gateway keeps
working. sandbox/agent no longer takes domains from
COREDESKTOP_SANDBOX_DOMAINS, which nothing else used.

The security checks skill now records step 3 as done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 16:13:32 -07:00
co-authored by Claude Opus 5.5
parent d974b91144
commit e991264ddc
7 changed files with 305 additions and 38 deletions
+3 -6
View File
@@ -11,9 +11,7 @@
#
# The config is sandbox/config/base.json, then sandbox/config/<agent>.json,
# then your own ~/.config/coredesktop/sandbox/base.json and <agent>.json, in
# the same format. Later files add to the lists in earlier ones. Domains in
# COREDESKTOP_SANDBOX_DOMAINS (space-separated) are allowed too; setup.sh uses
# it for Hermes' gateway, whose messaging server differs on each machine.
# the same format. Later files add to the lists in earlier ones.
# Wrapped in { ...; exit; } so bash reads the whole script up front; update
# replaces this file (git pull) while agents are running.
@@ -114,9 +112,8 @@ done
# Outside the sandbox's writable paths, so the agent can't change its own rules
settings="$SETTINGS_DIR/$agent.$$.json"
if ! jq -s --arg domains "$COREDESKTOP_SANDBOX_DOMAINS" --arg socket "$gui_socket" \
"$MERGE"' | .network.allowedDomains += ($domains | split(" ") | map(select(. != "")))
| if $socket != "" then .filesystem.allowRead += [$socket] else . end' \
if ! jq -s --arg socket "$gui_socket" \
"$MERGE"' | if $socket != "" then .filesystem.allowRead += [$socket] else . end' \
"${configs[@]}" > "$settings"; then
echo "Couldn't read the sandbox config: ${configs[*]}"
exit 1