Skip to content

fix(gateway): deliver $HOME deliverables on root-run gateways#39063

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3f75f67b
Jun 4, 2026
Merged

fix(gateway): deliver $HOME deliverables on root-run gateways#39063
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3f75f67b

Conversation

@teknium1

@teknium1 teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Root-run gateways now deliver agent-generated files from their working dir instead of silently dropping them.

A root-run gateway has $HOME=/root, which is on the MEDIA system-path denylist. So when the agent emitted MEDIA:/root/work/proposal.docx, the gateway rejected it and the user got a "here is your file" reply with nothing attached. Root cause: /root is a denied prefix that shadows the operator's entire own home, when the more-specific home-subdir denylist (~/.ssh, ~/.aws, ...) is the actual protection.

Changes

  • gateway/platforms/base.py: _path_under_denied_prefix() no longer treats the running user's own $HOME as denied. The exception only matches when the denied prefix is $HOME, so credential sub-dirs (~/.ssh, ~/.aws, ...), Hermes secrets (~/.hermes/.env, auth.json, config.yaml), and another user's home all stay blocked — they're separate, more-specific denylist entries.
  • tests/gateway/test_platform_base.py: +5 tests — root-home deliverable accepted; credential subdir / ~/.hermes/.env / another-user's-home / symlink-to-credential all still refused.

Validation

case before after
/root/work/proposal.docx (root gateway) dropped delivered
/root/.ssh/id_rsa blocked blocked
~/.hermes/.env, auth.json blocked blocked
other user's home (non-root gateway) blocked blocked
symlink in workdir → ssh key blocked blocked
/etc/*, /proc/* blocked blocked
strict mode: stale root-home file blocked blocked
strict mode: fresh root-home file delivered (recency) delivered (recency)

Adversarial E2E run against the real validator with live files + symlinks confirms every row. tests/gateway/test_platform_base.py: 148 passed.

Credit / relationship to #38108

Diagnosis, reproduction (live Telegram DM), and root-cause analysis are entirely @GodsBoy's (#38108 / issue #38106), credited via Co-authored-by. This is the minimal denylist fix — same user-facing outcome (~27 LOC change) instead of #38108's staging/copy subsystem (~530 LOC, a second credential denylist table to keep in sync). Platform adapters upload by path, so the file delivers in place; no cache duplication needed.

Closes #38106. Supersedes #38108.

Infographic

retro-pop-grid

Root-run gateways have $HOME=/root, which is on the MEDIA system-path
denylist, so the gateway silently dropped agent-generated deliverables
under /root (e.g. /root/work/proposal.docx) — the user got a 'here is
your file' reply with nothing attached.

_path_under_denied_prefix now treats the running user's own home as
deliverable: the home tree itself is no longer denied, while the
more-specific denied paths inside it (~/.ssh, ~/.aws, ~/.hermes/.env,
auth.json, config.yaml) stay blocked because they are separate denylist
entries. The exception only matches when the denied prefix IS $HOME, so
a non-root gateway still can't deliver another user's home.

Diagnosis, reproduction, and the failing-case analysis are from
@GodsBoy (#38108 / #38106). Implemented here as the minimal denylist
fix rather than a staging/copy subsystem.

Co-authored-by: GodsBoy <dhuysamen@gmail.com>
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-3f75f67b vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9805 on HEAD, 9805 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5089 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels Jun 4, 2026
@teknium1 teknium1 merged commit 2982122 into main Jun 4, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-3f75f67b branch June 4, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gateway silently drops safe local MEDIA files from working dirs (e.g. /root) instead of staging them

2 participants