Fix unsafe gateway MEDIA path delivery#30432
Merged
teknium1 merged 1 commit intoMay 23, 2026
Merged
Conversation
Collaborator
|
Competing fix for #29150 (GHSA-jmf9-9729-7pp8). Other open PRs addressing the same vulnerability: #16547, #4686, #10026, #12850, #6084, #26424. This PR has the most comprehensive coverage — validates at every delivery site, handles symlink escapes, and includes operator-configurable allowlist via |
Contributor
Author
|
Oh, the issue actually did have PRs for it, just none of them were marked as such. Well, if this one has the most comprehensive coverage then maybe it wasn't not in vain. |
teknium1
added a commit
that referenced
this pull request
May 23, 2026
This was referenced May 23, 2026
Gpapas
pushed a commit
to Gpapas/hermes-agent
that referenced
this pull request
May 23, 2026
Mucky010
pushed a commit
to Mucky010/hermes-agent
that referenced
this pull request
May 24, 2026
exosyphon
pushed a commit
to exosyphon/hermes-agent
that referenced
this pull request
May 24, 2026
mathias3
pushed a commit
to mathias3/hermes-agent
that referenced
this pull request
May 28, 2026
Bryce-huang
pushed a commit
to wbkunlun/hermes-agent
that referenced
this pull request
May 29, 2026
mosaiq-systems
pushed a commit
to mosaiq-systems/hermes-agent
that referenced
this pull request
May 29, 2026
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
Seven74AI
pushed a commit
to Seven74AI/hermes-agent
that referenced
this pull request
Jun 13, 2026
alt-glitch
pushed a commit
that referenced
this pull request
Jun 14, 2026
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.
Hi, very interested in your project, but haven't had a chance to try it yet. I saw your tweet and decided to try Codex with GPT-5.5-xhigh on the first P0 issue without an attached PR. As I'm not familiar with the codebase at all I've just looked at tests to see if no revard was hacked, and the only suspicious thing I see is in
tests/cron/test_scheduler.pyafter line 2203. Please tell me if you'll find this at least somewhat valuable, happy to follow up or do the same for other issues as well.Fixes #29150.
Summary
This blocks arbitrary local file delivery from model-emitted
MEDIA:tags and auto-detected local file paths in gateway media extraction.The fix adds a shared validator for native media delivery paths. It only allows existing regular files under Hermes-managed media cache roots, legacy cache roots, or explicit operator-configured roots from
HERMES_MEDIA_ALLOW_DIRS. It resolves symlinks before containment checks so a symlink inside an allowed cache cannot point at an arbitrary host file.Changed
gateway/platforms/base.py.send_message, and Yuanbao media sends.send_messagetool schema text so agents are toldMEDIA:paths must be under Hermes media caches or explicit allowlisted roots.send_messagefiltering.Validation
HOME=/tmp/hermes-test-home scripts/run_tests.sh tests/gateway/test_platform_base.py tests/gateway/test_tts_media_routing.py tests/tools/test_send_message_tool.py tests/cron/test_scheduler.pypassed: 229 tests..venv/bin/python -m ruff check cron/scheduler.py gateway/platforms/base.py gateway/platforms/weixin.py gateway/run.py tools/send_message_tool.py tools/yuanbao_tools.py tests/cron/test_scheduler.py tests/gateway/test_platform_base.py tests/gateway/test_tts_media_routing.py tests/tools/test_send_message_tool.pypassed.git diff --checkpassed..venv/bin/python -m py_compile gateway/platforms/base.py gateway/run.py gateway/platforms/weixin.py cron/scheduler.py tools/send_message_tool.py tools/yuanbao_tools.py tests/gateway/test_platform_base.py tests/gateway/test_tts_media_routing.py tests/tools/test_send_message_tool.py tests/cron/test_scheduler.pypassed.Notes
I initially ran the affected files without overriding
HOME; the cron file hit environment failures because the sandbox could not create/home/mac/.hermes. Re-running withHOME=/tmp/hermes-test-homeisolated the tests and passed.