---
title: "Security and hardening"
description: "How HolaClaw Server decides who may talk to the agent, what the agent may do on its own, when a person must approve, where secrets live, and how to deploy it so an allowed tool call reaches as little as possible."
updated: 2026-11-17
canonical: https://holaclaw.ai/docs/server/security
---

HolaClaw Server never assumes it is sandboxed. It runs on a VM, a local machine or a remote server, and checks every request and every tool call itself. This page explains each layer and what you can tighten.

Four layers apply, each before the next one is reached:

| Layer | Decides | Configured in |
| --- | --- | --- |
| Control API | which client may do what, by token and scope | tokens, the socket's file permissions |
| Router | who may talk to the agent at all, as which identity and role | `channels.toml`, identities and invites |
| Policy | every tool call: allow, ask a person, or deny | `[policy]` in `agent.toml`, grants |
| Process | what an allowed call can still reach | the deployment: container or systemd unit |

Commands are written as `holaclaw …`. Run them [the way your deployment does](/docs/server/choose-a-deployment#where-things-are).

## Identities and access

Everyone who talks to the agent is an identity with a role: `owner` (one, created by `holaclaw init`), `admin` or `user`. Who may reach the agent on each channel, and how you let people in with invite codes, is in [Invite people](/docs/server/invite-people) and the [channels.toml reference](/docs/server/channels-toml#letting-people-in).

What matters for security:

- **A turn runs under one role**, that of the person it answers. A turn that answers messages from several people runs under the strictest of their roles, so a user's message cannot ride on an admin's.
- **A stranger let in by open access is a guest.** Guests are judged by the agent's `[policy.guest]` block, get no grants, cannot save memory and cannot use the browser.
- **Open access is refused** by `holaclaw check` (`ACC001`) when the guest policy allows `exec`, `write` or `external`.
- **A disabled identity can do nothing.** Its messages are dropped, its tasks do not run and its tokens are refused, until an admin enables it again.
- **Every user of an agent shares its workspace and its browser logins.** The workspace belongs to the agent, not to a person.

## The control API and tokens

Every client, the `holaclaw` command included, talks to the daemon over its HTTP API. Endpoints and scopes are in the [API reference](/docs/server/api).

- **The unix socket** is the default transport. Whoever can open it acts as the owner, with admin scope. On a system install its directory is mode `0700` and owned by the service user.
- **TCP** (`server.listen`) is optional. A loopback address is served as is. Any other address is refused at start unless TLS is configured or `allow_insecure_transport` is set (`NET001`). Every TCP request needs a bearer token, except pairing.
- **Tokens** start with `hb_`. The database keeps only their hash: the secret is shown once, when it is created.
- **Scopes.** `client` covers a person's own conversations. `admin` adds approvals, identities, tokens, tasks, memory, connectors, credentials, skills and backups. A token is `client` unless asked otherwise, and a `user` can only hold `client` tokens. Every request acts at the lower of the token's scope and the identity's role.
- **Owner tokens.** Only the owner creates, changes, rotates or revokes the owner's tokens. Admins can manage each other's tokens, and every change records who made it.
- **Pairing codes** are single-use, short-lived (15 minutes by default) and stored as hashes. Five wrong codes within 10 minutes from one address block that address for the rest of the window. A pairing link carries the code, so treat it as a short-lived secret.

Manage tokens with `holaclaw token`:

```sh
holaclaw token list
holaclaw token create --identity <id> --name <name>
holaclaw token rotate <token id>
holaclaw token revoke <token id>
```

Revoked tokens are kept, with who revoked them, and every message's trace records the token that sent it.

> [!TIP] Expose the API with care
> Keep `server.listen` on loopback, or behind a TLS proxy. Use `allow_insecure_transport` only behind such a proxy or inside a container.

## Tools and policies

Every tool has a risk class, and the agent's policy gives each class a decision: `allow`, `ask` (a person must approve) or `deny`. `deny` always wins.

| Class | Tools |
| --- | --- |
| `read` | `memory.search`, `files.read`, `files.list`, `attach`, `react`, `skill.load` |
| `write` | `memory.save`, `memory.forget`, `files.write`, `skill.save`, `skill.forget`, `task.create` |
| `external` | `fetch`, `image.generate`, `browser.do`, and connector tools without a read-only hint |
| `exec` | `exec` |

The defaults allow `read`, `write` and `external`, and deny `exec`. The policy keys, and the `[policy.guest]` and `[policy.task]` blocks, are in the [agent.toml reference](/docs/server/agent-toml#policy).

What contains each tool:

- **Files** stay inside the agent's workspace: `..`, absolute paths and symlinks out of it are refused.
- **`fetch`** refuses private, loopback, link-local and reserved addresses, on every redirect too. It sends no cookies and uses no proxy from the environment.
- **Replies, attachments, reactions and task results** go where the message came from. No tool takes a person or a conversation as an argument.
- **`browser.do`** is given to every agent once the browser is on. Keep an agent off it with `[browser] enabled = false` in its `agent.toml`, and limit the sites with `browser.allow`.

### Every tool call, in order

1. The class decision for the person's role and the kind of run.
2. `[policy.tools]` overrides, by tool name or connector id. They can tighten or loosen, but never lift a class `deny`, and for a guest they can only tighten.
3. A connector tool the server marks destructive: `allow` becomes `ask`.
4. With `taint_escalates`, a tainted `exec` or `external` call: `allow` becomes `ask`.
5. On an `ask`: `exec_allow`, then the grants.
6. The guard, when one is set.
7. `allow` runs the tool, `deny` refuses it, `ask` asks a person.

A refused call reaches the model as `denied by policy: <tool> (<reason>)`, with a fixed reason. `holaclaw trace` shows every step as a `policy.decision` event.

### exec

`exec` runs `/bin/sh -c <command>` in the agent's workspace. It inherits nothing from the daemon: the environment is rebuilt with a fixed `PATH`, `HOME` is the workspace, and stdin is empty. It times out after 30 seconds by default and 300 at most, and output is capped at 16 KiB.

> [!CAUTION]
> `exec` has no sandbox of its own. A command can read whatever the daemon's user can, secrets included. Run HolaClaw Server in the [container](/docs/server/container), keep `exec` at `ask`, and allow-list only the commands you need.

`exec_allow` entries are command prefixes, matched on whole words: `"git status"` covers `git status -s`, not `git statusx`. A command with any shell metacharacter (`;`, `&`, `|`, `$`, a backtick, `>`, `<`, parentheses, `*`, `?`, braces, `~` or a newline) is never covered. The allow-list is skipped in a tainted turn.

## Approvals and grants

An `ask` pauses only the conversation it belongs to.

- **Who answers.** An owner or admin. When an owner or admin started the turn on a channel, the prompt appears in the chat: buttons on Telegram, Slack and Google Chat, a reaction elsewhere. Everyone else's approvals are answered with `holaclaw approvals` and `holaclaw approve <id>` or `holaclaw deny <id>`, or the HolaClaw apps with an admin token. The first answer wins.
- **The prompt** names the tool and, for `exec`, the command. A guard verdict, when there is one, comes first.
- **Timeout.** An approval waits 5 minutes. No answer is a deny, and a restart expires every pending approval.

An approval can be kept as a grant:

| Answer | Covers |
| --- | --- |
| once | this call only |
| `--session` | this tool for the rest of the conversation |
| `--always` | this tool in any conversation of the agent, for the person who approved it only |
| task grant | this tool in one task, set when an admin creates the task |

For `exec`, a grant covers the command as a prefix, like `exec_allow`. Grants never apply to guests and never lift a `deny`.

## The guard model

The optional `guard` model role scores each tool call, from 0 to 1, for how safe it is to run without asking, and labels it `benign`, `destructive`, `exfiltration`, `escape` or `injection`. It is never asked about a `read` call or a `deny`.

```toml title="agents/main/agent.toml"
[models]
guard = "jev"                  # a decision model, or any chat model

[policy]
guard_mode      = "recommend"  # or "auto"
guard_threshold = 0.7
```

- **`recommend`** (the default) only adds questions. Below the threshold, `allow` becomes `ask`, and the verdict appears in the approval prompt.
- **`auto`** answers the clear cases so nobody is asked. At or above the threshold the call runs, below it the call is denied, except a `benign` call that fell short, which is asked. An error or a timeout is a deny. `auto` never lifts a `deny`, never allows a tainted `exec` or `external` call, never allows a destructive connector tool without a grant, and never overrules a person's grant.
- **A decision model** answers in well under a second. A chat model answers one word and is slower, and a reasoning model adds seconds to every tool call.

> [!NOTE]
> The guard sees the tool, its description and up to 1500 bytes of its arguments: paths, URLs and commands. A guard on a cloud provider sends those off the machine.

## Untrusted content

Content from outside is untrusted, always:

- `fetch` and `browser.do` results;
- connector results, `trusted` connectors included;
- documents attached to a message;
- a summary of any of these.

The model gets untrusted text inside `<untrusted>` … `</untrusted>` markers that the content cannot close. Files the agent reads from its own workspace are not marked.

Each untrusted result is also scored by a decision model (the `guard` role when it is a decision model, else `decide`) for whether it tries to steer the agent. A score at or above `taint_threshold` (0.5) taints that call and the next `taint_decay_calls` (3) calls of the turn. With no decision model, a scorer error, or a result over 256 KiB, the content counts as steering. Attached documents taint every call of their turn.

With `taint_escalates = true`, a tainted `exec` or `external` call needs an approval, and the allow-list no longer answers it. In `auto` mode the guard never allows one.

> [!WARNING]
> `taint_escalates` is off by default. With the default policy, a turn steered by a web page can call `fetch`, `browser.do` or a connector tool without asking. Turn it on for an agent that reads the web and holds anything private.

## Secrets

Secrets live in `auth.toml`, never in the config files. See [Secrets](/docs/server/secrets).

- `auth.toml` must have mode `0600` (`SEC001`), and the config directory must not be world-writable (`SEC005`).
- Credentials are write-only over the API: they can be set, never read back, except in a backup an admin asked to include them in.
- The database holds no secret, only token hashes, but it holds every conversation. `check` warns `DAT002` when others can read it.
- The model never sees a secret, so no tool argument can carry one. `exec` children get a rebuilt environment. Errors are scrubbed of tokens before they are logged.
- A provider (`NET003`) or connector (`CON003`) with a token, reached over plain `http` off the machine, is a check error.
- Backups leave `auth.toml` out unless you pass `--include-secrets`. Keep such an archive like a key.

## Deployment hardening

The policy decides which calls run. The deployment narrows what an allowed call can still reach. It does not replace the policy.

### Container

The [container](/docs/server/container) is the recommended deployment. `exec` sees only the container, never the host, and runs only the programs in the image. The daemon and the browser sidecar run as two separate users inside it. Publish the API on loopback only (`-p 127.0.0.1:8484:8484`), and put TLS in front of it before you expose it further.

### System service

The systemd unit runs the daemon as the `holaclaw` system user, with no login shell:

- It can write only its state directory, its config directory (for `auth.toml`, `connectors.toml` and skills), the secrets directory and the browser sidecar's socket directory. The rest of the filesystem is read-only, and `/home` is hidden.
- The control socket lives in `/run/holaclaw/`, mode `0700`. Everything the daemon creates is private to its user.
- No capabilities, no new privileges, no namespaces, no writable-executable memory, a private `/tmp` and `/dev`, the `@system-service` system call set, and only unix and IP sockets.

`exec` children inherit all of this: the same user, the same read-only filesystem and the same system call filter.

### The browser sidecar

Chromium runs in its own process, as its own user, `holaclaw-browser`, because it cannot run under the daemon's restrictions: its JIT needs writable-executable memory and its sandbox needs user namespaces. The sidecar holds no provider keys, no `auth.toml`, no database and no network listener, only its unix socket, and is capped at 2 GiB of memory. Chromium's own sandbox is never turned off: when it cannot start, the browser does not launch and `check` reports `BRW003`. See [The browser](/docs/server/browser).

### Checklist

- Run the container, or the hardened unit, and keep the host up to date.
- Keep `server.listen` on loopback, or behind TLS.
- Keep `exec` denied, or at `ask` with a short `exec_allow`.
- Set `browser.allow` for every agent that uses the browser.
- Turn on `taint_escalates` for agents that read the web and hold anything private.
- Keep `access.dm = "invite"` (the default) in `channels.toml` rather than open access, unless the guest policy is read-only.
- Run `holaclaw check` after every change, and [verify each release](/docs/server/upgrades#verify-a-release) before you install it.

## Related

- [agent.toml reference](/docs/server/agent-toml#policy)
- [Secrets](/docs/server/secrets)
- [HTTP API and events](/docs/server/api)
- [Check rules](/docs/server/check-rules)

