Home / Docs / Security & Auth

Security & Authentication

Zubo is designed for single-owner, self-hosted operation. All data stays on your machine, and no external services are contacted unless you explicitly configure them. This page covers every security feature in the system: API authentication, tool permissions, secret management, sandboxing, rate limiting, and access control.

API Authentication

By default, API authentication is disabled. This is appropriate when Zubo is running on localhost for a single user. If you expose the web chat port to a network or the internet, you should enable authentication.

Enabling Authentication

zubo config set auth.enabled true

Once enabled, all /api/* endpoints require a valid API key in the Authorization header.

Creating API Keys

zubo auth create-key [label]

This generates a cryptographically random 64-character key. The raw key is displayed only once — copy it immediately. Before storage, the key is hashed with SHA-256, so the plaintext value cannot be recovered from the database.

Using API Keys

Include the key in the Authorization header on every request:

curl -H "Authorization: Bearer <your-key>" http://localhost:3000/api/chat

Managing Keys

Session Tokens

Session tokens provide short-lived authentication for the web dashboard when API authentication is enabled.

Tool Permissions

Every tool in Zubo has a permission level that controls how it executes. There are three levels:

Level Behavior Example Tools
auto Executes immediately with no user confirmation datetime, memory_write, memory_search, web_search, url_fetch
confirm Requires explicit user approval before execution shell, file_write, secret_delete, twitter_posts
deny Blocked entirely — the tool cannot be used (custom blocked tools configured by the user)

Confirmation Flow

When the agent calls a tool with confirm permission, the following flow occurs:

  1. The agent invokes a confirm-level tool (e.g., shell)
  2. The executor generates a random UUID confirmation token with a 10-minute TTL
  3. The tool returns a CONFIRMATION REQUIRED message containing the token
  4. The agent describes the intended action to the user and asks for approval
  5. If the user approves, the agent retries the tool call with _confirmToken included in the input
  6. The server validates that the token matches the specific tool name and has not expired
  7. The tool executes normally

This design prevents the LLM from spoofing confirmations — only the server can issue valid confirmation tokens, and each token is bound to a specific tool invocation.

Secret Management

Secrets (API keys, tokens, passwords) are stored securely in the local SQLite secrets table. The agent can use secrets by name but never sees their actual values in conversation context.

Storing Secrets

There are three ways to store a secret:

Accessing Secrets in Skills

User-installed skills can access secrets via environment variables:

const token = process.env.ZUBO_SECRET_GITHUB_TOKEN;

Only secrets explicitly declared in the skill manifest are passed to the skill process.

Managing Secrets

Skill Sandboxing

User-installed skills (stored in ~/.zubo/workspace/skills/) run in isolated Bun subprocesses. This provides a security boundary between the main Zubo process and third-party skill code. Built-in tools are not sandboxed — they run in the main process.

Sandbox Features

Configuration

zubo config set sandbox.enabled true
zubo config set sandbox.timeoutMs 30000

Skills installed from the Zubo skill registry are always sandboxed, regardless of the global setting.

Shell Command Safety

The shell tool includes a blocklist of dangerous command patterns. Any command matching these patterns is rejected before execution:

Environment Sanitization

Before executing any shell command, the environment is sanitized: API keys, tokens, and secrets are stripped from the environment variables passed to the child process. This prevents accidental leakage of credentials through commands like env or printenv.

Output Limits

This prevents runaway commands from consuming excessive memory in the agent context.

File Access Restrictions

The file_read and file_write tools are restricted to the user’s home directory. Path traversal attacks using .. are blocked — all paths are resolved and validated before access.

Blocked Paths (Read and Write)

Additional Write Blocks

The file_write tool additionally blocks writing to shell configuration files:

This prevents the agent from accidentally or maliciously modifying your shell startup scripts.

HTTP Request Safety

The http_request tool blocks requests to private and internal IP ranges, preventing Server-Side Request Forgery (SSRF) attacks:

Range Description
127.0.0.0/8Localhost / loopback
10.0.0.0/8Private network (Class A)
172.16.0.0/12Private network (Class B)
192.168.0.0/16Private network (Class C)
169.254.0.0/16Link-local addresses
0.0.0.0Unspecified address

This prevents the agent from being tricked into making requests to internal services, cloud metadata endpoints (e.g., 169.254.169.254), or other hosts on your local network.

Rate Limiting

Zubo includes per-IP sliding-window rate limiting to prevent abuse when the API is exposed to a network.

Defaults

Configuration

zubo config set rateLimit.chatPerMinute 30
zubo config set rateLimit.uploadPerMinute 5

Behavior

When a client exceeds the rate limit, the server responds with 429 Too Many Requests and includes a Retry-After header indicating how many seconds to wait before retrying.

Channel Access Control

Each messaging channel supports an allowlist to restrict who can interact with Zubo. When the allowlist is empty (the default), anyone who can reach the channel can send messages.

Channel Config Field Value Format
TelegramallowedUsersUser ID numbers (e.g., [123456789])
DiscordallowedUsersUser ID strings (e.g., ["98765432109876543"])
SlackallowedUsersUser ID strings (e.g., ["U01ABC2DEF"])
WhatsAppallowedNumbersPhone numbers (e.g., ["+15551234567"])
SignalallowedNumbersPhone numbers (e.g., ["+15559876543"])

Messages from users not on the allowlist are silently ignored. Always configure allowlists for channels exposed to the public internet.

Sub-Agent Security

When the main agent delegates tasks to sub-agents, several security constraints are enforced:

Data Security

All Zubo data is stored locally on your machine in the ~/.zubo/ directory. Nothing is sent to external servers unless you explicitly configure an LLM provider or integration.

Logging

Zubo uses structured logging with automatic redaction of sensitive information.

Automatic Redaction

Any log entry containing fields named keys, values, secrets, passwords, tokens, or credentials will have their values replaced with *** before being written to disk.

Log Levels

Log Location and Access

Best Practices