feat(dashboard): multipart attachment upload + authenticated static file serve - #43772
Closed
nparkison wants to merge 1 commit into
Closed
feat(dashboard): multipart attachment upload + authenticated static file serve#43772nparkison wants to merge 1 commit into
nparkison wants to merge 1 commit into
Conversation
…ile serve
Adds POST /api/files/attachment-upload (streaming multipart, 100 MB cap,
saves to ~/.hermes/uploads/) and GET /files/{name} (Bearer header or
?token= query auth, traversal-guarded) to the dashboard web server.
Motivation: lets remote clients (e.g. mobile apps) upload images for
image.attach and fetch served files without filesystem access to the
gateway host. Complements the existing base64 /api/files/upload with a
streaming path suited to large files and memory-constrained clients.
Reuses the existing session-token auth mechanisms.
Includes tests: 25 cases covering auth, sanitization, collision
suffixing, size cap, traversal, and media types.
Contributor
|
✅ Verified — File attachment upload with auth and path traversal protection Reviewed the multipart upload endpoint and authenticated static file serve.
The |
T02200059
pushed a commit
to T02200059/hermes-agent
that referenced
this pull request
Jun 19, 2026
调研结论:原计划建 owner/acp/ 一整套 ACP 传输+管理+桥来接 opencode,是重复造轮子 且安全前提靠不住: - Hermes 主线已有 skills/autonomous-ai-agents/opencode (terminal 跑 CLI),零新代码 - ACP 定位是 editor↔agent (LSP 类比),不是 agent↔agent 委派 - '子agent审批边界下传' 是全行业开放难题:opencode NousResearch#12133 子 session permission 丢弃, claude-code NousResearch#43772 同类问题,靠 ACP 做不可靠 - 可靠的安全边界是 terminal 的 check_all_command_guards (hardline floor + gateway 审批), 把 opencode 当受管辖子进程,而非依赖 opencode 内部 ACP permission 删除原 设计.md / 实现计划.md / probe-findings.md,以本调研结论取代。 保留探针实测副产物(§5)备查,标注未来若 NousResearch#12133 修复可重启评估。
19 tasks
Contributor
|
Thanks for the multipart-upload and authenticated-download work. This automated hermes-sweeper review found that the requested capability is already implemented on current
The current managed-files implementation also avoids duplicating a separate fixed |
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.
What does this PR do?
Adds a streaming multipart upload endpoint and an authenticated static file serve route to the dashboard web server, so remote clients (e.g. mobile apps) can attach images to sessions and download gateway-served files without filesystem access to the gateway host.
POST /api/files/attachment-upload— multipart fieldfile, streamed to~/.hermes/uploads/in chunks, 100 MB cap (413 over), filename sanitization + collision suffixing (-1,-2, …). Response:{"name","path","url","size"}. The returnedpathis directly usable with theimage.attachWS method.GET /files/{name}— serves only from~/.hermes/uploads/; auth via the normal Bearer header or a?token=query parameter (for download managers that can't set headers); constant-time token comparison; path-traversal guarded;.apkserved asapplication/vnd.android.package-archive.This complements the existing base64
/api/files/upload(whole file in memory as a data URL) with a streaming path suited to large files and memory-constrained clients. Reuses the existing session-token auth mechanisms; no new imports or dependencies.Context: built for an open-source native Android client for hermes-agent — https://github.com/nparkison/hermes-android — where it powers photo/file attachments and gateway-served APK self-update. The implementation has been in daily use against a v0.16.0 gateway; this PR adapts it to current
main(route renamed to avoid colliding with the newer base64 upload endpoint) and adds tests.Related Issue
No existing issue — happy to open one first if you prefer issue-first flow.
Fixes #
Type of Change
Changes Made
hermes_cli/web_server.py— new endpoints + helpers (~166 lines)tests/hermes_cli/test_attachment_upload.py— 25 tests (auth, sanitization, collision suffixing, size cap, traversal, media types)How to Test
pytest tests/hermes_cli/test_attachment_upload.py -q— 25 testscurl -F "file=@pic.png" -H "Authorization: Bearer $TOKEN" http://127.0.0.1:9119/api/files/attachment-upload→ JSON contractcurl "http://127.0.0.1:9119/files/pic.png?token=$TOKEN"→ file bytes; same URL without token → 401; traversal attempts → 404, never file contentChecklist
Code
pytest tests/ -qnot run (heavy env) — ran the new suite plustests/test_web_server.pyandtests/hermes_cli/test_web_server_files.py: all pass, no regressionsDocumentation & Housekeeping
pathlib+expanduser, no POSIX-only primitivesScreenshots / Logs