fix(gateway): deliver $HOME deliverables on root-run gateways#39063
Merged
Conversation
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>
Contributor
🔎 Lint report:
|
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 emittedMEDIA:/root/work/proposal.docx, the gateway rejected it and the user got a "here is your file" reply with nothing attached. Root cause:/rootis 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$HOMEas 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
/root/work/proposal.docx(root gateway)/root/.ssh/id_rsa~/.hermes/.env,auth.json/etc/*,/proc/*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