Skip to content
7-layer defense-in-depth model

7-layer defense-in-depth model

hermes-agent.nousresearch.com • November 22, 2026

Hermes Agent is designed with a defense-in-depth security model. This page covers every security boundary — from command approval to container isolation to user authorization on messaging platforms.

The security model has eight layers:

User authorization — who can talk to the agent (allowlists, DM pairing)

Dangerous command approval — human-in-the-loop for destructive operations

File write safety — denylist and optional write sandbox for write_file / patch

Container isolation — Docker/Modal (and the Singularity plugin) sandboxing with hardened settings

MCP credential filtering — environment variable isolation for MCP subprocesses

Context file scanning — prompt injection detection in project files

Cross-session isolation — sessions cannot access each other's data or state; cron job storage paths are hardened against path traversal attacks

Input sanitization — working directory parameters in terminal tool backends are validated against an allowlist to prevent shell injection

Dangerous Command Approval ​

Before executing any command, Hermes checks it against a curated list of dangerous patterns. If a match is found, the user must explicitly approve it.

The approval system supports three modes, configured via approvals.mode in ~/.hermes/config.yaml :

The full set of keys:

Setting approvals.mode: off disables all safety prompts. Use only in trusted environments (CI/CD, containers, etc.).

YOLO mode bypasses all dangerous command approval prompts for the current session. It can be activated three ways:

CLI flag : Start a session with hermes --yolo or hermes chat --yolo

Slash command : Type /yolo during a session to toggle it on/off

Environment variable : Set HERMES_YOLO_MODE=1

The /yolo command is a toggle — each use flips the mode on or off:

YOLO mode is available in both CLI and gateway sessions. /yolo applies only to the session it was typed in. It is saved with the session, so it survives a restart: a messaging chat keeps it across gateway restarts, and the TUI and the Desktop app keep it when you reopen or resume the session. On a messaging platform, /new and /resume start the conversation with approvals back on.

When YOLO is active, Hermes shows two persistent visual reminders so it's hard to forget that approval prompts are bypassed:

A red banner line at session start when YOLO is already active: ⚠ YOLO mode — all approval prompts bypassed . Hidden when YOLO is off so the default banner stays uncluttered.

A ⚠ YOLO fragment in the status bar across all width tiers, updated live as you toggle YOLO on or off (rich-text renderer and plain-text fallback).

YOLO mode disables all dangerous command safety checks for the session — except the hardline blocklist (see below). Use only when you fully trust the commands being generated (e.g., well-tested automation scripts in disposable environments).

YOLO and approvals.mode: off also skip the trust: untrusted MCP prompt: a write-capable tool on an untrusted server runs without asking, with each source's usual reach. /yolo covers only the chat it was typed in (another chat is still asked); --yolo and HERMES_YOLO_MODE cover the sessions of the Hermes process they were given to; approvals.mode: off covers every chat and cron job of that profile. They do not skip:

An MCP server's spend limit. A call that would take the chat past a declared spend_limit still asks, and where nobody can answer (a cron job, hermes chat -q ) it is refused. The limit is a budget you set, not a safety prompt.

Questions from an MCP server ( elicitation ), which ask you for input rather than for permission.

Payment-card fill prompts from the credential vault , which hand a card to a page, and MCP event subscriptions, which install a standing trigger.

For destructive session slash commands ( /clear , /new / /reset , /undo , /quit --delete — /exit --delete is an alias), the CLI also prompts for confirmation before running them. See Slash Commands — Confirmation prompts for destructive commands .

Supervised-gateway lifecycle restriction ​

The terminal tool has a separate, non-overridable guard against stopping or restarting the gateway from inside its own supervised process. A self-restart can terminate the tool before it finishes and cause a supervisor/auto-resume loop. User approval, YOLO mode, and force=True do not bypass this guard.

The guard also refuses process killers aimed at the interpreter image the gateway runs as — taskkill /F /IM python.exe , taskkill /FI "IMAGENAME eq python.exe" , Stop-Process -Name python , pkill -9 python3 , killall python , pkill -f python , and name-derived kills such as pgrep python | xargs kill — because a supervised gateway is literally a python process and such a command takes it (and the agent's own turn) down. Kills scoped to a process the agent owns pass: the proc_* id of a background job ( process(action="kill", …) ) or an explicit PID ( taskkill /F /PID , kill ). Other image names ( taskkill /F /IM notepad.exe ) are unaffected. The guard is active under every generated launcher — systemd unit, launchd plist, s6 run script and the Windows Scheduled Task — via the HERMES_SUPERVISED_CHILD marker they export.

On macOS, executed launchctl submit and launchctl bootstrap commands are restricted regardless of the job label . This is a conservative registration restriction intended to catch indirect restart helpers with neutral labels, not an inspection of the target plist. It also rejects independent scheduled jobs with RunAtLoad=false and no KeepAlive key; rejection does not establish that the job uses KeepAlive or controls Hermes.

For authorized LaunchAgent maintenance, use a separate shell outside the running gateway. Some independent load / unload commands currently pass the label-based checks, but that is not a target-verified exemption or a supported way to evade a bootstrap rejection. Read-only launchctl print is not a lifecycle operation. After external maintenance, distinguish the on-disk plist from the loaded job: validate the plist and read back the loaded schedule before reporting activation.

A tool rejection means the command did not execute through that tool call. An assistant declining to issue a call is a separate model decision; changing models does not change the terminal guard's policy.

Hardline Blocklist (Always-On Floor) ​

Some commands are so catastrophic — irreversible filesystem wipes, fork bombs, direct block-device writes — that Hermes refuses to run them regardless of:

--yolo / /yolo toggled on

Cron jobs running in headless approve mode

User explicitly clicking "allow always"

The blocklist is the floor below --yolo . It trips before the approval layer even sees the command, and there's no override flag. Patterns currently covered (not exhaustive; kept in sync with tools/approval_detection.py::HARDLINE_PATTERNS ):

If you hit the blocklist, the tool call returns an explanatory error to the agent and nothing runs. If a legitimate workflow needs one of these commands (you're the operator of a wipe-and-reinstall pipeline, for example), run it outside the agent.

The floor also fails closed on a command whose shell quoting cannot be parsed ( grep 'unterminated ): the error says malformed executable payload . Quoting is judged on the command exactly as written, so shell-valid escapes inside a quoted pattern ( grep -o "[^\"]*" file ) are not malformed, and an escaped quote before a separator ( echo "a\"b"; reboot ) does not hide the command that follows it.

User-Defined Deny Rules ( approvals.deny ) ​

The hardline blocklist is fixed and code-shipped. approvals.deny is its user-editable counterpart: a list of glob patterns that block matching terminal commands unconditionally — before --yolo , /yolo , and approvals.mode: off are consulted. Use it to run yolo-with-exceptions: "let the agent do everything, except these specific things, ever."

Patterns are fnmatch globs ( * , ? , [...] ) matched case-insensitively against the whole command text and individual executable-command candidates. git push --force* matches git push --force origin main but not git push origin main .

Matching runs over the same normalized/deobfuscated command variants the dangerous-pattern detector uses, so simple quoting tricks ( git pu""sh --force ) don't slip past a rule.

Executable candidates retain the literal path and also match its basename: sudo * covers /usr/bin/sudo -n id and ./sudo -n id . A path-specific rule such as /usr/bin/sudo * does not become a rule for every binary named sudo .

Quote-aware parsing exposes commands after assignments, leading redirections, ; , && , || , pipelines, groups, command substitutions, and ordinary if / then / else / do transitions. Supported launchers include sudo , env , command , exec , nohup , setsid , time , nice , timeout , stdbuf , ionice , chrt , taskset , and chroot . Known option operands are skipped; command -v / -V lookups are not executions. Shell -c payloads are inspected recursively. Literal executable-and-argument strings in env -S / --split-string use GNU quoting and escapes (including \_ word boundaries and \c termination), with the remaining command arguments appended; shell punctuation inside those arguments stays data unless an actual shell -c consumes it. env -a / --argv0 values are arguments, not executable names. Shell and GNU split-string do not introduce executable candidates.

In the additional executable candidates, whitespace between words is collapsed, but quoted argument content and argument paths are retained. An exact rule such as git status therefore also matches env git\tstatus; echo done (where \t represents a tab). Quoted mentions such as echo 'sudo -n id' are not to commands. Existing whole-input globs such as *sudo* still intentionally match mentions anywhere.

YAML quoting: always quote patterns. A bare leading * is a YAML alias and fails to parse; { , ! , and : have their own YAML meanings. Single quotes are safest for shell-ish content.

User-defined deny rules apply to all terminal backends, including isolated containers, before any backend-specific approval shortcut.

A denied command returns a BLOCKED error to the agent telling it not to retry or rephrase. Nothing runs.

Like the rest of the approval config, changes take effect immediately (the config cache is mtime-keyed) — no session restart needed.

Deny rules are a shell-command policy, not a complete shell interpreter or an OS capability sandbox. Normalization does not resolve arbitrary variables (including GNU env -S ${NAME} expansion), aliases, functions, renamed binaries, scripts, interpreter programs, or every shell/launcher grammar (for example, case-pattern syntax, clustered launcher options, or options embedded inside an env -S string). Do not use a basename deny rule as a guarantee that a capability cannot be reached by other means. For containment, use OS permissions and an isolated backend with appropriately restricted mounts, credentials, and network access. This matching behavior does not change the configured approval mode or the empty-deny-list default.

When a dangerous command prompt appears, the user has a configurable amount of time to respond. If no response is given within the timeout, the command is denied by default (fail-closed).

An expired prompt cannot be reopened: the pending entry is discarded and the agent is told not to retry on its own within that turn. To run the operation after all, send a new message asking for it (for example "go ahead and run that now") — the agent issues a fresh tool call, which raises a fresh approval card, and a "once" approval applies only to that call. A timeout is not counted as a denial, so asking again is never penalized.

Configure the timeout in ~/.hermes/config.yaml :

What Triggers Approval ​

The following patterns trigger approval prompts (defined in tools/approval.py ):

Container bypass : When running in docker , modal , daytona , or vercel_sandbox backends (or a container plugin backend such as singularity or sprites ), dangerous command checks are skipped because the container itself is the security boundary. Destructive commands inside a container can't harm the host.

execute_code Scripts ​

A script run by execute_code can call subprocess , os or shutil directly, and those calls never pass through the patterns above. Messaging, API and other gateway sessions therefore ask once for the whole script before it starts; a denied or unanswered script never runs. cron_mode , single_query_mode and unattended_mode decide the script at once, as they decide a command; YOLO and mode: off skip the prompt.

Local sessions (classic CLI, TUI, Desktop, ACP editor) follow the interactive CLI's rule instead. Under manual (and smart ), a turn the session's viewer typed gets no whole-script approval : Python-level file and process operations inside the script run without a prompt, and only the script's terminal() calls ask, each on the session's own prompt, as in the CLI before the one-gateway runtime. The exemption needs both a turn the viewer submitted and a viewer attached who can answer approvals when the script starts. These keep the whole-script approval in a local session:

turns nobody typed in it: plugin inject_message turns, delegation completions, background-process and watch-pattern notices, /loop ticks, heartbeats, hosted-room tasks

delegate_task children and /bg / /btw side tasks

a viewer's turn that runs while no viewer who can approve is attached

Approval Flow (CLI) ​

In the interactive CLI, dangerous commands show an inline approval prompt:

once — allow this single execution

session — allow this pattern for the rest of the session

always — add to permanent allowlist (saved to config.yaml )

deny (default) — block the command

Approval Flow (Gateway/Messaging) ​

On messaging platforms, the agent sends the dangerous command details to the chat and waits for the user to :

yes , y , approve , ok , or go to approve

no , n , deny , or cancel to deny

A messaging approval never asks you to approve a command you cannot read in full. When the command is too long for the approval card, Hermes first sends the whole command as its own message (split across several messages if needed), and the card says the preview was shortened. If the full command cannot be shown (the send fails, or the command itself contains a triple-backtick fence), the card offers Deny only. Review such a command in the CLI or the desktop app. On platforms that cut long messages instead of splitting them (ntfy, DingTalk, Photon, LINE), the plain-text prompt puts the answer instructions before the command. When the command would still be cut, the prompt offers only /deny and shows the same "preview shortened" notice.

The HERMES_EXEC_ASK=1 environment variable is automatically set when running the gateway.

Who can answer an approval in a shared chat ( approvals.approvers ) ​

With approvers narrowed from ["*"] , only these people can approve or deny a command:

the user whose message started the turn that raised it;

the user ids listed in approvers , using each platform's own id form (Slack U… , Telegram numeric id, Matrix @user:server );

the platform's admins of the chat the approval came from: allow_admin_from in a DM, group_allow_admin_from in a group (the same scopes slash commands use; a DM admin is not a group admin), from the profile whose bot received the chat.

Identical commands raised at the same time by two different requesters get one prompt each, so one requester's answer never decides the other's. A turn that carries messages from two members (follow-ups merged while the agent was busy) has no single requester: its approvals go to the listed approvers and admins only.

When anyone else clicks a button, adds a reaction, or sends /approve , /deny or a bare "yes", they get Only can answer this approval. The command stays pending, so the requester can still answer it. Where the platform supports a private , only the clicker sees that note: a Slack ephemeral message, a Discord ephemeral , a Telegram callback alert, a Feishu toast or a Teams card response. Matrix, WhatsApp and the relay post it in the chat instead.

The same rule covers the other prompts a member can answer for someone else: a slash-command confirmation ( /reload-mcp 's Approve Once / Always / Cancel) and the agent's clarify question (a choice button, "Other", or a typed answer). Another member's tap gets the same note and the prompt stays pending; another member's typed message is handled as their own message, never as the answer.

With slash admin gating ( allow_admin_from / group_allow_admin_from ) set for the chat's scope , the default approvers: ["*"] no longer means "any admitted member": answering an approval is /approve or /deny , and answering a slash-command confirmation runs that command, so only someone allowed to run that command in the chat can answer, on every path (button, reaction, typed /approve , bare yes / always , typed confirm ). That is the scope's admins, plus members whose user_allowed_commands lists approve (who may then also deny) or deny (deny only), or the confirmed command. Anyone else, the member whose message raised the approval included, can answer neither way: they get ⛔ /approve is admin-only here and the prompt stays pending for an admin, or is denied when it times out.

When both are set, a narrowed approvers takes precedence: it is the explicit answer to "who approves", so the requester, the listed ids and the scope's admins answer with a button, reaction or bare "yes", as described above, whatever user_allowed_commands says. Typing /approve or /deny is itself a slash command, so it still needs that command's permission.

A DM with the bot's owner keeps working when the owner is on the DM admin list. Clarify questions are not commands and only follow approvers .

Discord interactions through the relay are checked more tightly. The relay forwards a Discord button press or application command (such as /approve or /deny ) without checking who sent it. So under approvers: ["*"] , a member answers with one only once the relay has delivered one of their messages to this gateway (since it last started); anyone else must be the requester or one of the scope's admins, on top of the rules above. Other senders get the same note and the prompt stays pending. Any other Discord interaction (an application command such as /status or /new , a modal) from a sender the relay has not delivered a message from is dropped unless they are one of the scope's admins. When Hermes starts again, a member's application commands do nothing until they have sent a message. Ordinary messages, and button presses on the relay's other platforms, keep the rules above.

Picker cards ( /model , /reasoning , /fast and the usage-limit switch offer) and the /update Yes/No prompt always belong to the member who opened them, whatever approvers says: only that member and the chat scope's admins can tap them or, for /update , answer by typing. Anyone else gets the same private note and the card stays open; their typed text is an ordinary message. A member refused an admin-only command therefore cannot apply an admin's open card instead.

The setting is read when the approval is raised, so with multiplexed profiles each profile's own config.yaml decides. Host surfaces (CLI, TUI, Desktop, the API server) answer as the host and are not affected. Matrix keeps its own stricter MATRIX_APPROVAL_REQUIRE_SENDER (default on). QQBot already accepts clicks only from the session's own user.

Permanent Allowlist ​

Commands approved with "always" are saved to ~/.hermes/config.yaml :

These patterns are loaded at startup and silently approved in all future sessions.

Entries can be exact command text, a shell-style glob ( podman * ), or a dangerous-pattern rule key such as script execution via heredoc (the key shown in the approval prompt). Rule keys are honored on every surface, including unattended ones: a cron job, hermes chat -q run or webhook session under cron_mode / single_query_mode / unattended_mode: deny still runs a command whose detected rule key is in command_allowlist .

The setting must be a list of strings. Legacy installs that stored a list as a quoted YAML/JSON string recover that list at load time and log a warning to re-save it with hermes config edit . Other malformed values are ignored with a warning; they never become per-character approvals. Loading does not rewrite your configuration file.

Use hermes config edit to review or remove patterns from your permanent allowlist.

The list is read when Hermes starts. A pattern you remove while a session is already running stays approved in that session until it writes the file (the time you answer always to a prompt) or you restart Hermes. If you removed it for safety reasons, restart.

Mining Approval History ( hermes approvals suggest ) ​

Instead of answering the same prompt session after session, you can mine your past approval decisions into allowlist proposals:

The command scans the session database ( ~/.hermes/state.db ) for dangerous-classified commands that actually executed — i.e. commands you approved — aggregates them into patterns ( git push * , or the dangerous-class key for compound commands), and ranks them by approval frequency:

Nothing is ever applied automatically — the default run is read-only; only an explicit --apply N[,M...] writes to config.yaml .

Destructive classes are never proposed , no matter how often they were approved: recursive deletes, sudo , disk/device writes, credential and system-config edits, pipe-to-shell, SQL DROP/TRUNCATE, process kills, and every hardline class are excluded outright. rm -rf build/ approved 100 times still never yields an rm entry.

Proposals already covered by your existing command_allowlist are skipped.

Credentials inside mined commands are masked ( ghp_… , bot : URLs, KEY=value assignments, bearer tokens) in both the printed e.g. examples and the --json payload, using the same redactor as terminal output. Masked text is never used as an allowlist pattern: a command whose glob would embed a credential ( TOKEN=… git … ) is proposed under its dangerous-class key instead. The session database itself still holds the command as it was executed.

Useful flags: --days N (history window, default 90), --min-count N (minimum approvals to qualify, default 2), --limit N , and --db PATH .

Before write_file or patch touches disk, Hermes checks the target path against a denylist and an optional sandbox. Blocked writes return an error to the agent immediately — there is no approval prompt and no way to override from the chat UI. The model may still claim the edit succeeded; when display.file_mutation_verifier is on (default), trust the file-mutation verifier footer over the assistant's closing summary.

Protected paths (always blocked) ​

These categories are always denied, even when HERMES_WRITE_SAFE_ROOT is unset:

Project-local .env , .env.local , .env.production and .envrc files are read-denied anywhere on disk (the file tools refuse to read them) but remain writable: the agent can create or edit them for you, it just cannot read the values back.

Sensitive paths inside the safe root are still blocked — pointing HERMES_WRITE_SAFE_ROOT at $ does not allow writing ~/.ssh/id_rsa .

The ~ in the OS-credential rows means every a write can land in, not just the process : the OS user's real , the profile ( {HERMES_HOME}/ under TERMINAL_HOME_MODE=profile , containers and spawned workers, where the process is pinned), and named accounts ( ~root/.ssh/authorized_keys ). An absolute path to the real 's ~/.aws/credentials is denied even when the agent process runs with pointed elsewhere.

Safe-root violations return Write denied: '…' is outside HERMES_WRITE_SAFE_ROOT (…) . Credential-path blocks use Write denied: '…' is a protected system/credential file.

Exception — ~/.ssh/config is approval-gated, not hard-blocked. The SSH client config holds no private-key material and editing it (host aliases, ProxyJump , VS Code Remote-SSH targets) is a routine task, so write_file / patch route it through the same approve-once/session/always prompt the terminal tool already uses for ~/.ssh writes — instead of the flat refusal that used to apply. It can still carry ProxyCommand / Match exec directives that run commands, so the write is never silent. Non-interactive callers (ACP file bridge, background jobs with no human channel) fail closed. Private keys, authorized_keys , and everything else under ~/.ssh/ remain hard-blocked.

HERMES_WRITE_SAFE_ROOT (optional sandbox) ​

When set, write_file and patch may only target paths inside the listed directory prefix(es). Anything outside is hard-blocked — not routed through dangerous-command approval.

Set automatically in the official Docker image ( HERMES_WRITE_SAFE_ROOT=/opt/data )

Supports multiple roots separated by : on Unix or ; on Windows

Do not add to ~/.hermes/.env casually. If you set it to a project directory, the agent cannot write to ~/.hermes/cron/jobs.json , profile skills, or other Hermes state outside that prefix

To allow both a workspace and Hermes :

Unset the variable to restore unrestricted writes (subject to the protected-path denylist). Full reference: HERMES_WRITE_SAFE_ROOT .

Cron and other Hermes state ​

Do not ask the agent to patch ~/.hermes/cron/jobs.json directly. Use the cronjob_manage tool, hermes cron , or /cron — they update the job store through the supported API. The same applies to other Hermes control files when write safety blocks direct edits.

Write guards apply to write_file and patch only, with one exception: the Windows NT/device-namespace row is also enforced on reads — read_file , search_files , @file: / @folder: context references and the ACP file bridge all refuse those paths on the raw string, before anything resolves them. The terminal tool runs as the same OS user and can still cat or overwrite denied paths via shell commands. The denylist reduces accidental damage and gives models a clear stop signal; it does not sandbox a hostile or compromised agent.

User Authorization (Gateway) ​

When running the messaging gateway, Hermes controls who can interact with the bot through a layered authorization system.

Authorization Check Order ​

The _is_user_authorized() method checks in this order:

Per-platform allow-all flag (e.g., DISCORD_ALLOW_ALL_USERS=true )

DM pairing approved list (users approved via pairing codes)

Platform-specific allowlists (e.g., TELEGRAM_ALLOWED_USERS=12345,67890 )

Global allowlist ( GATEWAY_ALLOWED_USERS=12345,67890 )

Global allow-all ( GATEWAY_ALLOW_ALL_USERS=true )

Platform Allowlists ​

Set allowed user IDs as comma-separated values in ~/.hermes/.env :

The global allow-all can also live in config.yaml as gateway.allow_all_users: true (or top-level allow_all_users: true ); a true value is bridged to GATEWAY_ALLOW_ALL_USERS at gateway startup (re-derived on every config load and restart, so flipping it back to false closes the gate), an explicit env var wins, and the gateway logs a warning naming config.yaml as the grant source. In a multi-profile gateway a secondary profile sets GATEWAY_ALLOW_ALL_USERS in its own .env (its config.yaml is never bridged into the process environment).

If no allowlists are configured and GATEWAY_ALLOW_ALL_USERS is not set, all users are denied . The gateway logs a warning at startup:

For more flexible authorization, Hermes includes a code-based pairing system. Instead of requiring user IDs upfront, unknown users receive a one-time pairing code that the bot owner approves via the CLI.

An unknown user sends a DM to the bot

The bot replies with an 8-character pairing code

The bot owner runs hermes pairing approve on the CLI

The user is permanently approved for that platform

Control how unauthorized direct messages are handled in ~/.hermes/config.yaml :

pair is the default for chat-style DM platforms. Unauthorized DMs get a pairing code .

ignore silently drops unauthorized DMs.

decline sends one short, polite decline ("I can only chat with my owner") instead of a pairing code, then ignores further messages from that sender for 24 hours. Customize the text with unauthorized_dm_decline_message .

Email defaults to ignore unless platforms.email.unauthorized_dm_behavior: pair is set, because inboxes can contain unrelated unread mail.

Platform sections override the global default, so you can keep pairing on Telegram while keeping WhatsApp silent.

Security features (based on OWASP + NIST SP 800-63-4 guidance):

Pairing CLI commands:

The official Docker image runs the gateway as the unprivileged hermes user (uid 10000) via gosu , but docker exec defaults to root. Approval files created by root are written with mode 0600 root:root and the gateway cannot read them — the approval is silently ignored ( #10270 ).

Always pass -u hermes :

If you already ran the command as root and the user is still unauthorized, restart the container — the entrypoint will fix ownership on the start.

Storage: Pairing data is stored in ~/.hermes/pairing/ with per-platform JSON files:

{platform}-pending.json — pending pairing requests

{platform}-approved.json — approved users

_rate_limits.json — rate limit and lockout tracking

Container Isolation ​

When using the docker terminal backend, Hermes applies strict security hardening to every container.

Docker Security Flags ​

Every container runs with these flags (defined in tools/environments/docker.py ):

SETUID / SETGID are not in the base list — they're added conditionally when the container starts as root and an init/entrypoint must drop privileges (the s6 privilege-drop path). They're skipped when the container already runs as a non-root --user . The /run tmpfs is also split out from the base list and mounted per-image (hardened noexec by default, exec only for s6-overlay images that exec from /run ).

Container resources are configurable in ~/.hermes/config.yaml :

Filesystem Persistence ​

Persistent mode ( container_persistent: true ): Bind-mounts /workspace and /root from ~/.hermes/sandboxes/docker/ /

Ephemeral mode ( container_persistent: false ): Uses tmpfs for workspace — everything is lost on cleanup

For production gateway deployments, use docker , modal , daytona , or vercel_sandbox backend to isolate agent commands from your host system. This eliminates the need for dangerous command approval entirely.

If you add names to terminal.docker_forward_env , those variables are intentionally injected into the container for terminal commands. This is useful for task-specific credentials like GITHUB_TOKEN , but it also means code running in the container can read and exfiltrate them.

Terminal Backend Security Comparison ​

Environment Variable Passthrough ​

Both execute_code and terminal strip sensitive environment variables from child processes to prevent credential exfiltration by LLM-generated code. However, skills that declare required_environment_variables legitimately need access to those vars.

First-party platform credentials — the BUZZ_* variables used by the Buzz messaging platform — are passed through to terminal children (foreground and background/PTY spawns) only when the session is actually operating as a Buzz agent : the process is a Buzz-ACP managed agent ( BUZZ_MANAGED_AGENT set by the Buzz Desktop harness) or the live gateway session's platform is buzz . This lets a Buzz platform agent invoke its platform-mandated CLI (e.g. buzz ) from the terminal tool, while Telegram/CLI/cron sessions on the same host keep the variables stripped. Because _sanitize_subprocess_env also feeds workers (e.g. the ddgs web- subprocess), the computer-use driver binary, and user-script runners (bang ! commands, quick commands, cron scripts, webhook-filter scripts), those children receive the variables too when spawned from a Buzz session. The carve-out is terminal-only : it does not apply to execute_code , browser/TUI-host spawns ( hermes_subprocess_env ), Docker/Modal children, or env_passthrough registration, which remain sealed.

Two mechanisms allow specific variables through the sandbox filters:

1. Skill-scoped passthrough (automatic)

When a skill is loaded (via skill_view or the /skill command) and declares required_environment_variables , any of those vars that are actually set in the environment are automatically registered as passthrough. Missing vars (still in setup-needed state) are not registered.

After loading this skill, TENOR_API_KEY passes through to execute_code , terminal (local), and remote backends (Docker, Modal) — no manual configuration needed.

Prior to v0.5.1, Docker's forward_env was a separate system from the skill passthrough. They are now merged — skill-declared env vars are automatically forwarded into Docker containers and Modal sandboxes without needing to add them to docker_forward_env manually.

2. Config-based passthrough (manual)

For env vars not declared by any skill, add them to terminal.env_passthrough in config.yaml :

The managed scope can set the same list (an administrator's, or a sandbox launcher's for the variables its children need); a managed list replaces the profile's, and provider credentials are refused from either.

Both lists apply to terminal , execute_code and no_agent cron scripts alike. A declared variable is forwarded with the value of the profile the child runs for: when one process serves several profiles (multi-profile gateway, Desktop/dashboard backend) each profile's declared value comes from its own .env / secret sources, never from the process environment the launch profile populated, and the launch profile's .env credentials are dropped from a served profile's children.

Credential File Passthrough (OAuth tokens, etc.) ​

Some skills need files (not just env vars) in the sandbox — for example, Google Workspace stores OAuth tokens as google_token.json under the active profile's HERMES_HOME . Skills declare these in frontmatter:

When loaded, Hermes checks if these files exist in the active profile's HERMES_HOME and registers them for mounting:

Docker : Read-only bind mounts ( -v host:container:ro )

Modal : Mounted at sandbox creation + synced before each command (handles mid-session OAuth setup)

Local : No action needed (files already accessible)

You can also list credential files manually in config.yaml :

Paths are relative to ~/.hermes/ . Files are mounted to /root/.hermes/ inside the container. This list is read by tools/credential_files.py ( terminal.credential_files ) — it lives under the terminal: block but is loaded by the credential-files module, not the core terminal backend, so it isn't part of the bundled DEFAULT_CONFIG snapshot.

The managed scope can set this list too. From either source, Hermes's own credential stores ( .env , auth.json , mcp-tokens/ and the other files the agent is denied from reading) are never mounted: an entry that names one is skipped with a warning, as it is when a skill asks for it. The Google Workspace token files above are the exception a skill has as well.

Borrowed CLI logins (Codex CLI, Claude Code) ​

When Hermes has no usable login of its own for openai-codex or anthropic , it can borrow the Codex CLI's ~/.codex/auth.json and Claude Code's ~/.claude/.credentials.json (or Keychain entry) and refresh them on your behalf. Both use single-use, rotating refresh tokens: once two programs hold one token family, whichever refreshes first invalidates the other's copy, which shows up as "I logged in once in the terminal and Hermes keeps failing" (or the reverse). If you run those CLIs alongside Hermes, give Hermes its own login and turn adoption off:

With the switch off Hermes never reads or refreshes those files: the claude_code credential-pool row disappears, hermes auth list prints one line saying so, and the log carries one INFO line per process. Only automatic adoption is affected — hermes auth add openai-codex still asks before importing an existing Codex CLI login. Automatic recovery also only repairs the credential Hermes already holds: a Codex CLI/Desktop login into a different ChatGPT workspace is refused with a warning (re-authenticate with hermes auth add openai-codex ), and a login you complete while recovery is running is never overwritten. Add your own logins with hermes auth add anthropic / hermes auth add openai-codex .

What Each Sandbox Filters ​

Security Considerations ​

The passthrough only affects vars you or your skills explicitly declare — the default security posture is unchanged for arbitrary LLM-generated code

Credential files are mounted read-only into Docker containers

Skills Guard scans skill content for suspicious env access patterns before installation

Missing/unset vars are never registered (you can't leak what doesn't exist)

Hermes infrastructure secrets (provider API keys, gateway tokens) should never be added to env_passthrough — they have dedicated mechanisms. Such a name is refused when declared, and a declared name that a platform adapter claims later (a plugin adapter registering after the skill loaded) stops being forwarded from then on

MCP Credential Handling ​

MCP (Model Context Protocol) server subprocesses receive a filtered environment to prevent accidental credential leakage.

Safe Environment Variables ​

Only these variables are passed through from the host to MCP stdio subprocesses:

Plus any XDG_* variables. All other environment variables (API keys, tokens, secrets) are stripped .

Variables supplied by an external secret source (Bitwarden, 1Password, a command helper) are also passed, except Hermes-managed credentials: model-provider keys, tool keys Hermes uses itself, and bot, gateway and relay tokens. That covers every name Hermes reads such a credential by: the numbered rotation keys ( DEEPSEEK_API_KEY_2 ), any variable a credential pool entry points at ( source: env:MY_KEY ), any variable the profile's config.yaml names as a provider key ( key_env / api_key_env on model , custom_providers , providers , auxiliary or fallback entries, or a credential field such as api_key written as ${VAR} / ${env:VAR} ), and the profile-suffixed form the active profile uses ( TELEGRAM_BOT_TOKEN_ ). Those are stripped wherever they are stored. If a server needs one, declare it in that server's env (for example OPENAI_API_KEY: "${OPENAI_API_KEY}" ).

Variables explicitly defined in the MCP server's env config are passed through:

Credential Redaction ​

Error messages from MCP tools are sanitized before being returned to the LLM. The following patterns are replaced with [REDACTED] :

GitHub PATs ( ghp_... )

OpenAI-style keys ( sk-... )

token= , key= , API_KEY= , password= , secret= parameters

Website Access Policy ​

You can restrict which websites the agent can access through its web and browser tools. This is useful for preventing the agent from accessing internal services, admin panels, or other sensitive URLs.

When a blocked URL is requested, the tool returns an error explaining the domain is blocked by policy. The blocklist is enforced on web_extract , browser , vision_analyze and video_analyze URLs, and skills hub downloads. A web_extract redirect to a blocked host is caught after the provider has fetched it, so the page is withheld from the agent but the host still saw the request. web_search takes a query, not a URL, so it is not gated, and its result list is not filtered. Kanban URL attachments, cron URL monitors and gateway media downloads apply only the private-address SSRF check.

See Website Blocklist in the configuration guide for full details.

All URL-capable tools (web , web extract, vision, browser) validate URLs before fetching them to prevent Server-Side Request Forgery (SSRF) attacks. Blocked addresses include:

Private networks (RFC 1918): 10.0.0.0/8 , 172.16.0.0/12 , 192.168.0.0/16

Loopback : 127.0.0.0/8 , ::1

Link-local : 169.254.0.0/16 (includes cloud metadata at 169.254.169.254 )

CGNAT / shared address space (RFC 6598): 100.64.0.0/10 (Tailscale, WireGuard VPNs)

Cloud metadata hostnames : metadata.google.internal , metadata.goog

Reserved, multicast, and unspecified addresses

SSRF protection is always active for internet-facing use and DNS failures are treated as blocked (fail-closed). Redirect chains are re-validated at each hop to prevent redirect-based bypasses.

The same guard covers fetches whose URL comes from a remote party rather than from you: image/video URLs returned by a generation provider, reference-image URLs a model supplies for edits, pet spritesheets and the petdex manifest, and skills.sh sitemap entries. A provider or index that points one of those at a private or metadata address is refused before any connection opens; the operator's own provider base_url is not affected — a download fetched directly from your configured base_url (the OpenRouter video content endpoint) skips only the private-address class check on that first hop, while the cloud-metadata floor still applies and any redirect it issues is re-validated in full — and an image-generation provider hosted on your LAN needs security.allow_private_urls: true (below) for the result URLs it returns to be cached locally.

Intentionally allowing private URLs ​

Some setups legitimately need private/internal URL access — networks that resolve .arpa to RFC 1918 space, LAN-only Ollama/llama.cpp endpoints, internal wikis, and the like. For those cases there's a global opt-out:

When on, web tools, the browser, vision URL fetches, gateway media downloads, cron monitor_url fetches, and A2A push callbacks no longer reject RFC 1918 / loopback / link-local / CGNAT destinations. Cloud-metadata endpoints ( 169.254.169.254 , metadata.google.internal , and the like) stay blocked even with this on. This is a deliberate trust boundary — only enable it on machines where the agent running arbitrary prompt-injected URLs against the local network is an acceptable risk. Public-facing gateways should leave it off.

The host-substring guard (which blocks lookalike Unicode domain tricks even when the underlying IP is public) stays on regardless of this setting.

The managed scope can pin this key (or the legacy browser.allow_private_urls ). A pinned value decides this guard in either direction: HERMES_ALLOW_PRIVATE_URLS and the profile's own keys are read only when the managed scope pins neither. Cloud and CDP browsers also read browser.allow_private_urls as their own switch, so pin that key as well to hold them.