Add dashboard TLS and allowed-host flags - #29959
Open
anitguru wants to merge 1 commit into
Open
Conversation
19 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the direct-TLS and host-restriction work. The feature is still distinct from the related dashboard service work: #37119 explicitly says it excludes direct --tls-cert / --tls-key support.
Problems
- The new allowlist is enforced only by HTTP middleware at
hermes_cli/web_server.py:263on this PR. The PR’s WebSocket routes (/api/ptyat line 3443,/api/wsat 3564,/api/pubat 3596, and/api/eventsat 3625) do not call_is_accepted_host;git grepfinds no such WebSocket enforcement. The stated host restriction therefore does not cover dashboard chat upgrades.
Suggested changes
- Apply the normalized host allowlist to WebSocket Host and HTTP(S) Origin validation too, with allow/reject coverage for both protocols.
- Salvage against current main’s
uvicorn.Config/uvicorn.Serverstartup athermes_cli/web_server.py:17123, rather than the olduvicorn.runcall. Preserve current sidecar host resolution (hermes_cli/web_server.py:14766) while adding TLS and WSS support.
Automated hermes-sweeper review.
| host_header = request.headers.get("host", "") | ||
| if not _is_accepted_host(host_header, bound_host): | ||
| allowed_hosts = getattr(app.state, "allowed_hosts", None) | ||
| if not _is_accepted_host(host_header, bound_host, allowed_hosts=allowed_hosts): |
Contributor
There was a problem hiding this comment.
This applies the new allowlist only to HTTP middleware. The PR’s /api/pty, /api/ws, /api/pub, and /api/events WebSocket endpoints do not call _is_accepted_host, so a WebSocket upgrade bypasses the stated Host restriction. Please thread the same normalized allowlist through WebSocket Host and Origin validation and add coverage.
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
hermes dashboard --tls-certand--tls-keyflags that pass Uvicornssl_certfile/ssl_keyfileoptions for direct HTTPS serving.--allowed-hostvalues so LAN/all-interface dashboard binds can fail closed for unlisted Host headers while preserving existing default behavior when no allowlist is configured.wss://for the dashboard PTY sidecar URL when TLS is enabled.Verification
scripts/run_tests.sh tests/hermes_cli/test_web_server.py tests/hermes_cli/test_web_server_host_header.py→ 157 passedpython -m py_compile hermes_cli/web_server.py hermes_cli/main.pyruff check hermes_cli/web_server.py hermes_cli/main.py tests/hermes_cli/test_web_server_host_header.pypython -m hermes_cli.main dashboard --help | grep -E -- '--tls-cert|--tls-key|--allowed-host'git diff --checkhermes dashboard --host 127.0.0.1 --port 19443 --no-open --tls-cert ... --tls-key ..., and verifiedcurl --noproxy '*' --max-time 10 -k https://127.0.0.1:19443/api/statusreturned HTTP 200.