Skip to content

[Feature]: Enforce sandboxed execution for messaging platform sessions #4281

@mu-hashmi

Description

@mu-hashmi

Problem or Use Case

When Hermes is accessed via the messaging gateway (Telegram, Discord, Slack, WhatsApp, Signal), the terminal backend is whatever is configured globally. If terminal.backend: local, commands from messaging users execute directly on the host machine.

The gateway's authorization layer (DM pairing, allowlists) controls who can talk to the agent, but not what damage an authorized session can do. Once a user is authorized, the agent executes LLM-generated commands with the host user's full privileges. Combined with:

This means a prompt injection via a Telegram message (or a confused deputy from web content the agent fetches) can result in arbitrary host command execution with no approval gate and no containment.

The existing dangerous command approval system explicitly skips checks for container backends because "the container itself is the security boundary." For gateway sessions on the local backend, neither the approval system nor container isolation protects the host.

Proposed Solution

1. Warn on unsafe gateway configuration

When hermes gateway start is invoked with terminal.backend: local, emit a visible warning:

⚠ Gateway is running with local terminal backend.
  Commands from messaging platforms will execute on this machine.
  Consider using a sandboxed backend: docker, daytona, or modal.
  See: https://hermes-agent.nousresearch.com/docs/user-guide/security#gateway

2. Per-session sandbox creation

Optionally (or by default for gateway), create an ephemeral sandbox per messaging session:

gateway:
  terminal_backend: daytona  # override global backend for gateway sessions
  sandbox_lifetime: 3600     # auto-cleanup after 1 hour of inactivity

The gateway already manages sessions. Each session gets its own sandbox via the existing terminal backend abstraction. Any container backend works here.

3. Document recommended production configuration

The production deployment checklist already recommends container backends but doesn't enforce or warn. For users running Hermes as an always-on Telegram bot on a VPS (a primary use case per the README), this is the most exposed attack surface.

Risk Context

Interaction with Existing Issues

Alternatives Considered

Feature Type

Performance / reliability

Scope

Large (new module or significant refactor)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverytool/terminalTerminal execution and process managementtype/securitySecurity vulnerability or hardening

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions