OpenClaw Secure Usage Guidelines
OpenClaw Secure Usage Guidelines
Section titled “OpenClaw Secure Usage Guidelines”Introduction
Section titled “Introduction”OpenClaw is convenient, but its permissions are broad, and misuse carries real risk. This post documents secure usage guidelines for OpenClaw as a reference.
Software Updates
Section titled “Software Updates”OpenClaw attracts a lot of attention, so security vulnerabilities surface regularly. Make a habit of updating on a schedule.
1. Update through OpenClaw itselfopenclaw update2. Update via npmnpm install -g openclaw@latest3. Update via pnpm — either command workspnpm add -g openclaw@latestpnpm update -g openclawLocal Models
Section titled “Local Models”When OpenClaw handles a task, it sends the relevant data to the model. With an online model, that means data disclosure. For confidential information or questions containing sensitive data, use a local model. For casual chat and web searches, an online model is fine.
Sensitive Data
Section titled “Sensitive Data”If you use an online model, avoid sending sensitive data to it. If you must, redact it first. Examples of sensitive data:
Personally identifiable information (PII): names, ID numbers, bank card numbers, home addresses.Proprietary business data: trade secrets, financial information, strategic plans, customer lists.Technical information: API keys, database credentials, system architecture details.Container Deployment
Section titled “Container Deployment”Deploy in a VM or container where possible — VMware, Docker, and so on. If it has to run on a host machine, dedicate a machine to it.
Never deploy OpenClaw on a production server, domain controller, core server, or primary work computer.
Local Access
Section titled “Local Access”For personal use, restrict access to local only (the default configuration): reachable only via 127.0.0.1. Even someone on the same network using an internal IP such as 192.x or 172.x can’t reach it.
Here’s the default configuration. mode is the run mode (local means OpenClaw runs on the local machine), and bind is the bind address (loopback means local access only).
"gateway": { "port": 18789, "mode": "local", "bind": "loopback",Run Under a Dedicated Account
Section titled “Run Under a Dedicated Account”Run OpenClaw under a dedicated, low-privilege system account, following least privilege. OpenClaw has the permissions of whichever account runs it, so a dedicated account constrains what it can do.
Restrict permissions on the OpenClaw directory and configuration file as well, so unrelated accounts can’t read, write, or execute them.
chmod 700 ~/.openclawchmod 600 ~/.openclaw/openclaw.jsonChange the Default Port
Section titled “Change the Default Port”The default port 18789 is easy to find with a scan. Change it under gateway → port in the config file, to 8789 for example:
"gateway": { "port": 8789, "mode": "local", "bind": "loopback",Firewall Configuration
Section titled “Firewall Configuration”Use the system firewall to allow only local access to OpenClaw:
sudo ufw allow from 127.0.0.1 to any port 8789Or allow a specific address if that fits your setup:
sudo ufw allow from x.x.x.x to any port 8789Strong Token Authentication
Section titled “Strong Token Authentication”OpenClaw’s default token is 32 characters. For more resistance to brute force, replace it with a 64- or 128-character token. Generate one with a model, a password tool, or this command:
openssl rand -base64 128Or with Python:
python -c "import secrets;print(secrets.token_urlsafe(128))"Session Isolation
Section titled “Session Isolation”Session isolation prevents memory contamination: conversations with agent A aren’t visible to agent B. It also matters when several people share one OpenClaw instance, since each person’s session stays independent. This is the default configuration; check that the following is present:
"session": { "dmScope": "per-channel-peer" }Key Management
Section titled “Key Management”Putting keys in plaintext in the configuration file is both non-compliant and a disclosure risk. Store keys in environment variables instead. On Windows, create a user-level variable such as DEEPSEEK_API (the name must be all uppercase), then reference it in the config file with ${}:
"profiles": { "deepseek:default": { "type": "api_key", "provider": "deepseek", "key": "${DEEPSEEK_API}" }Configured this way, other programs can use the variable too. If the variable is only for OpenClaw, add it under OpenClaw’s configuration menu instead:

To review all secrets OpenClaw knows about, run this command — it lists where each secret lives and whether it’s stored in plaintext:
openclaw secrets auditPermission Management
Section titled “Permission Management”Assign permissions to each agent according to what it actually does. A writing assistant, for example, shouldn’t have command execution. Configure this under Tools in OpenClaw’s agent section. The defaults include Minimal, Coding, and Full presets, and you can turn individual permissions on or off.

Disable high-risk permissions where you can: exec (arbitrary command execution), browser, web_fetch (fetching external content), web_search (search engine queries).
Skill Security
Section titled “Skill Security”Review every skill before installing it — a security scan or a manual review. Audit installed skills periodically too. In OpenClaw, you can install the following skill to security-check other skills:
https://clawhub.ai/itsclawdbro/skill-defender
Or scan with Snyk’s scanners:
https://github.com/snyk/agent-scan (suited to automation and continuous security assessment in CI/CD)
https://labs.snyk.io/experiments/skill-scan/ (online scanning)
If you download skills from a skill marketplace:
Pay attention to the security audit information on the right side. Trust Hub is the official review result; Socket is Socket.dev, a leading JS/Node.js supply chain security tool; Snyk is the online scanner mentioned above. Check all three.

Logging
Section titled “Logging”Enable log auditing so you can investigate incidents afterward. It’s under Configuration → Logging, with these settings:
Console Log Level: the output level for console logs.
Console Log Style: the console log style; pretty gives colored output.
Log File Path: the directory for log files.
Log Level: the output level for log files.
Max File Bytes: the maximum log file size, 500M by default. Writes stop once it’s exceeded.
Custom Redaction Patterns: custom redaction rules for what gets masked before it’s written to the log. Configuring this overrides the defaults.
Sensitive Data Redaction Mode: the built-in redaction rules. The tools option covers tool parameters, passwords, keys, and similar sensitive information, which is masked before being written to the log.


Or add the following to the config file:
"logging": { "level": "debug", "file": "D:\\openclaw\\.openclaw\\logs\\openclaw.log", "consoleLevel": "info", "consoleStyle": "pretty", "redactSensitive": "tools" },Sandbox Isolation
Section titled “Sandbox Isolation”A sandbox gives the agent an isolated, least-privilege runtime, so untrusted operations run inside a container. Add this configuration under the agent section to create a sandbox per agent:
"agents": { "defaults": { "sandbox": { "mode": "all", "scope": "agent", "workspaceAccess": "none" },sandbox enables the feature; mode: all runs every session in a sandbox; scope: agent controls how many containers are created — one per agent; workspaceAccess: none controls what the sandbox can see — only the .openclaw/sandboxes directory. These are examples; adjust to your situation.
Note that the default image is minimal: common runtime environments such as Python and Node aren’t included, and networking is off by default. Besides configuring all agents under the agents section, you can give a specific agent its own sandbox under list:
"agents": { "list": [ { "id": "research", "sandbox": { "mode": "all", "scope": "agent" } } ]}For the full set of options, see the official documentation:
https://docs.openclaw.ai/zh-CN/gateway/sandboxingdDirect Message Policy
Section titled “Direct Message Policy”If the agent is connected to external channels such as WeCom or Feishu, pay attention to the direct message policy — that is, who can communicate with the agent through the external bot. Suppose you create a bot app in Feishu: besides you, other employees in the company can find and access it, or add it to a group where everyone sees it. You need to restrict the DM policy.
The default policy is pairing: anyone can communicate with the agent, but receives an authorization code that must be entered on the OpenClaw side.
"channels": { "feishu": { "dmPolicy": "pairing",Another option is allowlist: only addresses on the list can communicate, and the list is set in allowFrom:
"channels": { "feishu": { "dmPolicy": "allowlist", "allowFrom": ["UserID1", "UserID2"]To allow everyone, set the policy to open and include * in the allowlist. To disable all direct messages, set the policy to disabled.
Periodic Audits
Section titled “Periodic Audits”Use the built-in security audit for periodic reviews:
openclaw security audit --deepIt checks for common risks — exposed gateway authentication, exposed browser control, overly permissive filesystem permissions, and so on. The fix flag applies fixes:
openclaw security audit --fixThe fix command applies several safeguards: if the privacy policy is open, it changes it to allowlist; if sensitive data redaction for logs is off, it changes it to tools; it ensures the OpenClaw directory has 700 permissions and the config file has 600.
Incident Response
Section titled “Incident Response”If OpenClaw is compromised, here’s a response procedure.
1. Containment and isolation
1. Stop the OpenClaw service.2. Disconnect the network.3. Change dmPolicy to disabled for any channel that poses risk.2. Eradication and credential rotation
1. Rotate OpenClaw's access key.2. If model credentials leaked, delete the existing key.3. Regenerate tokens for Feishu, WeCom, and other channels.4. If OpenClaw accesses databases, cloud services, or email, rotate the relevant passwords and keys.5. Check the skill directory and remove plugins of unknown origin or without authorization.3. Investigation and forensics
1. Collect logs; the exact path depends on your configuration.2. Collect session records — back up all jsonl files under ~/.openclaw/agents/<agentId>/sessions/.3. Collect system logs; look for anomalous logins and command execution.4. Collect anomalous IPs, anomalous users, and any content containing prompt injection.4. Recovery and rebuild
1. Confirm the issues are fixed and safeguards are in place.2. Restore service gradually and monitor closely.3. Write a post-incident report covering the timeline, root cause, impact assessment, response process, lessons learned, and follow-up improvements.Conclusion
Section titled “Conclusion”For more on using and configuring OpenClaw, see the official documentation:
https://docs.openclaw.ai/zh-CNThat covers security guidelines for using OpenClaw. Thanks for reading.