Skip to content

fix(docker): refuse root gateway runs in official image#19215

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/docker-root-gateway-guard-18936
Closed

fix(docker): refuse root gateway runs in official image#19215
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/docker-root-gateway-guard-18936

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

Fixes #18936.

If the official Docker image is started with an overridden entrypoint that bypasses /opt/hermes/docker/entrypoint.sh, hermes gateway run can run as root and create root-owned gateway state under /opt/data. That later breaks normal non-root dashboard/gateway runs after the entrypoint is restored.

This PR adds a runtime guard before the gateway starts:

  • detect root execution inside the official Docker checkout
  • refuse startup with clear guidance to keep /opt/hermes/docker/entrypoint.sh in the entrypoint chain
  • allow an explicit HERMES_ALLOW_ROOT_GATEWAY=1 escape hatch
  • document the same requirement in Docker docs and compose comments

Verification

  • scripts/run_tests.sh tests/hermes_cli/test_gateway.py
    • 25 passed, 4 warnings

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery area/docker Docker image, Compose, packaging labels May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docker Docker image, Compose, packaging 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.

docker: entrypoint.sh privilege drop not enforced — bypassing it causes gateway processes to run as root

2 participants