规则参考
每个受支持的规则命名空间,逐字段说明。属于 openclaw policy 参考的一部分。
策略规则参考
以下每条规则均为可选;只有当规则存在时才会运行检查。观察状态是现有的 OpenClaw 配置或工作区元数据。
渠道
| 策略字段 |
观察状态 |
使用场景 |
channels.denyRules[].when.provider |
channels.* 提供商和启用状态 |
拒绝来自 telegram 等提供商的已配置渠道。 |
channels.denyRules[].reason |
发现消息和修复提示上下文 |
说明拒绝该提供商的原因。 |
MCP 服务器
| 策略字段 |
观察状态 |
使用场景 |
mcp.servers.allow |
mcp.servers.* 标识符 |
要求每个已配置的 MCP 服务器都在允许列表中。 |
mcp.servers.deny |
mcp.servers.* 标识符 |
拒绝特定的已配置 MCP 服务器标识符。 |
模型提供商
| 策略字段 |
观察状态 |
使用场景 |
models.providers.allow |
models.providers.* 标识符和所选模型引用 |
要求已配置的提供商和所选模型引用使用已批准的提供商。 |
models.providers.deny |
models.providers.* 标识符和所选模型引用 |
按提供商标识符拒绝已配置的提供商和所选模型引用。 |
网络
| 策略字段 |
观察状态 |
使用场景 |
network.privateNetwork.allow |
私有网络 SSRF 逃逸路径 |
设置为 false 以要求保持禁用私有网络访问。 |
消息路由
| 策略字段 |
观察状态 |
使用场景 |
routing.requireBindings |
渠道路由绑定,不包括 ACP 绑定 |
要求至少存在一个消息路由绑定。 |
routing.requireConfiguredChannels |
绑定渠道标识符和已配置的 channels.* 标识符 |
检测过期或拼写错误的绑定渠道标识符。 |
routing.probes[].route |
公开的 OpenClaw 路由解析器 |
在不发送消息的情况下描述一个代表性的入站路由。 |
routing.probes[].expect.agentId |
解析后的代理标识符 |
要求路由到达已审查的代理。 |
routing.probes[].expect.matchedBy |
解析器匹配类型 |
要求具备已审查的对等方、账户、渠道或其他绑定具体性。 |
检查标识符必须唯一。路由支持 channel、可选的 accountId、
peer、parentPeer、guildId、teamId 和 memberRoleIds。对等方类型包括
direct、group 和 channel。matchedBy 可以包含一个或多个运行时
匹配类型,包括 binding.peer、binding.account、binding.channel
或 default。
路由检查仅为合规性检查。它们不会更改启动、
消息投递、绑定优先级或回退行为。发现项需要
操作员审查,因为自动更改绑定可能会重定向
私有消息。
入口和渠道访问
| 策略字段 |
观察状态 |
使用场景 |
ingress.session.requireDmScope |
session.dmScope |
要求使用已审查的私信隔离范围。 |
ingress.channels.allowDmPolicies |
channels.*.dmPolicy 和旧版渠道 DM 策略字段 |
仅允许已审查的私信渠道策略。 |
ingress.channels.denyOpenGroups |
渠道、账户和群组入口策略 |
拒绝已配置渠道和账户的开放群组入口。 |
ingress.channels.requireMentionInGroups |
渠道、账户、群组、guild 和嵌套提及门控配置 |
当群组入口开放或受提及门控时,要求启用提及门控。 |
网关
| 策略字段 |
观察状态 |
使用场景 |
gateway.exposure.allowNonLoopbackBind |
gateway.bind |
设置为 false 以要求使用回环 Gateway 绑定。 |
gateway.exposure.allowTailscaleFunnel |
Tailscale serve/funnel Gateway 状态 |
设置为 false 以拒绝 Tailscale Funnel 暴露。 |
| 策略字段 |
观察状态 |
使用场景 |
gateway.auth.requireAuth |
gateway.auth.mode |
设置为 true 以拒绝已禁用的 Gateway 认证。 |
gateway.auth.requireExplicitRateLimit |
gateway.auth.rateLimit |
设置为 true 以要求显式认证速率限制配置。 |
gateway.controlUi.allowInsecure |
设备身份不变量和源回退 |
设置为 false 以要求设备身份并拒绝 Host 头源回退。 |
gateway.remote.allow |
远程 Gateway 模式/配置 |
设置为 false 以拒绝远程 Gateway 模式。 |
gateway.http.denyEndpoints |
Gateway HTTP API 端点 |
拒绝端点 ID,例如 chatCompletions 或 responses。 |
gateway.http.requireUrlAllowlists |
Gateway HTTP URL 抓取输入 |
设置为 true 以要求 URL 抓取输入使用 URL 允许列表。 |
gateway.nodes.denyCommands |
gateway.nodes.commands.deny |
要求精确的节点命令 ID(例如 system.run)在 OpenClaw 配置中被拒绝。 |
gateway.nodes.denyCommands 是精确的、区分大小写的策略拒绝超集规则。
当策略必须证明特权节点命令已被 OpenClaw 配置显式拒绝时,使用它。如果部署有意允许某个特权节点命令,应在审查后更新 policy.jsonc,而不是仅依赖 gateway.nodes.commands.allow。
Agent 工作区
| 策略字段 |
观察状态 |
使用场景 |
agents.workspace.allowedAccess |
agents.defaults.sandbox.workspaceAccess 和 agents.entries.*.sandbox.workspaceAccess |
仅允许沙箱工作区访问值,例如 none 或 ro。 |
agents.workspace.denyTools |
全局和按代理的工具拒绝配置 |
要求变更工具(exec、process、write、edit、apply_patch)被拒绝。 |
沙箱态势
| 策略字段 |
观察状态 |
使用场景 |
sandbox.requireMode |
agents.defaults.sandbox.mode 和按代理模式 |
仅允许已审查的沙箱模式,例如 all 或 non-main。 |
sandbox.allowBackends |
agents.defaults.sandbox.backend 和按代理后端 |
仅允许已审查的沙箱后端,例如 docker 或 podman。 |
sandbox.containers.denyHostNetwork |
容器支持的沙箱/浏览器网络模式 |
拒绝主机网络模式。 |
sandbox.containers.denyContainerNamespaceJoin |
容器支持的沙箱/浏览器网络模式 |
拒绝加入另一个容器网络命名空间。 |
sandbox.containers.requireReadOnlyMounts |
容器支持的沙箱/浏览器挂载模式 |
要求挂载为只读。 |
sandbox.containers.denyContainerRuntimeSocketMounts |
容器支持的沙箱/浏览器挂载目标 |
拒绝容器运行时套接字挂载。 |
sandbox.containers.denyUnconfinedProfiles |
容器安全配置姿态 |
拒绝无限制容器安全配置。 |
sandbox.browser.requireCdpSourceRange |
沙箱浏览器 CDP 源范围 |
要求浏览器 CDP 暴露声明源范围。 |
策略将缺失的 sandbox.mode 视为其隐式默认值 off,因此 sandbox.requireMode 会将全新或未配置的沙箱报告为不在允许列表(例如 ["all"])内。
数据处理
| 策略字段 |
观察状态 |
使用场景 |
dataHandling.sensitiveLogging.requireRedaction |
运行时不变量 oc://openclaw.invariant/logging/redaction |
设置为 true 以记录该要求;OpenClaw 始终满足该要求。 |
dataHandling.telemetry.denyContentCapture |
diagnostics.otel.captureContent |
设置为 true 以拒绝遥测内容捕获。 |
dataHandling.retention.requireSessionMaintenance |
session.maintenance.mode |
设置为 true 以要求生效的会话维护模式为 enforce。 |
| 策略字段 |
观察状态 |
使用场景 |
dataHandling.memory.denySessionTranscriptIndexing |
memory.search.experimental.sessionMemory、memory.search.rememberAcrossConversations 以及按代理覆盖 |
设置为 true 以拒绝将会话转录索引到内存。 |
密钥
| 策略字段 |
观察状态 |
使用场景 |
secrets.requireManagedProviders |
配置 SecretRefs 和 secrets.providers.* 声明 |
设置为 true 以要求 SecretRefs 指向已声明的提供商。 |
secrets.denySources |
密钥提供商来源和 SecretRef 来源 |
拒绝诸如 exec、file 或其他已配置的来源名称。 |
secrets.allowInsecureProviders |
不安全密钥提供商姿态标志 |
设置为 false 以拒绝选择进入不安全姿态的提供商。 |
执行审批
执行审批检查默认读取运行时 exec_approvals_config 单例行,位于
~/.openclaw/state/openclaw.sqlite;当设置 OPENCLAW_STATE_DIR 时,则读取
$OPENCLAW_STATE_DIR/state 下的同一数据库。发现项使用稳定的
oc://exec-approvals.json/... URI 方案,该方案定位存储在该行中的权威 JSON 文档内的路径。
execApprovals.defaults.* 或 execApprovals.agents.* 下的姿态规则要求可读的工件证据;缺失或无效的工件会报告为
不可观察证据,而不是尽力通过。一旦可读,省略的字段继承运行时默认值:缺失的 defaults.security 为 full,且
缺失的代理安全继承该默认值。证据包括 defaults、
agents.*、agents.*.allowlist[].pattern、可选的 argPattern、生效的
autoAllowSkills 姿态以及条目来源——绝不包括套接字路径/token、
commandText、lastUsedCommand、已解析路径或时间戳。
| 策略字段 |
观察状态 |
使用场景 |
execApprovals.requireFile |
活动运行时 exec_approvals_config 行 |
设置为 true 以要求审批文档存在且可解析。 |
execApprovals.defaults.allowSecurity |
defaults.security,默认为 full |
仅允许已批准的默认审批安全模式。 |
execApprovals.agents.allowSecurity |
agents.*.security,继承默认值 |
仅允许已批准的按代理生效审批安全模式。 |
execApprovals.agents.allowAutoAllowSkills |
defaults.autoAllowSkills 和 agents.*.autoAllowSkills,继承运行时默认值 |
设置为 false 以要求严格的手动允许列表,而不使用隐式技能 CLI 审批。 |
execApprovals.agents.allowlist.expected |
聚合的 agents.*.allowlist[] 模式和可选 argPattern 条目 |
要求审批允许列表与已审查的模式集匹配。 |
示例:要求审批工件存在,拒绝宽松默认值,并且仅允许为选定代理使用已审查的执行审批姿态。
{
"execApprovals": {
"requireFile": true,
"defaults": {
// Security modes: "deny", "allowlist", or "full".
// This default permits only the locked-down deny posture.
"allowSecurity": ["deny"],
},
},
"scopes": {
"restricted-shell": {
"agentIds": ["family-agent", "groups-agent"],
"execApprovals": {
"agents": {
// Selected agents may use reviewed allowlist posture, but not "full".
"allowSecurity": ["allowlist"],
// false means skill CLIs must appear in the reviewed allowlist instead of
// being implicitly approved by autoAllowSkills.
"allowAutoAllowSkills": false,
"allowlist": {
"expected": [
// Simple entry: exact reviewed executable pattern with no argPattern.
"travel-hub",
// Constrained entry: pattern plus reviewed argument regex.
{ "pattern": "calendar-cli", "argPattern": "^sync\\b" },
"/bin/date",
],
},
},
},
},
},
}
身份验证配置文件
| 策略字段 |
观察状态 |
使用场景 |
auth.profiles.requireMetadata |
auth.profiles.* 提供商和模式元数据 |
要求配置身份验证配置文件包含 provider 和 mode 等元数据键。 |
auth.profiles.allowModes |
auth.profiles.*.mode |
仅允许受支持的身份验证配置文件模式,例如 api_key、aws-sdk、oauth 或 token。 |
| 策略字段 |
观察到的状态 |
适用场景 |
tools.requireMetadata |
受治理的 AGENTS.md 工具声明 |
要求受治理的工具声明元数据键,例如 risk、sensitivity 或 owner。 |
工具姿态
| 策略字段 |
观察到的状态 |
适用场景 |
tools.profiles.allow |
tools.profile 和 agents.entries.*.tools.profile |
仅允许工具配置文件 id,例如 minimal、messaging 或 coding。 |
tools.fs.requireWorkspaceOnly |
tools.fs.workspaceOnly 和每个代理的 tools.fs 覆盖 |
设置为 true 以要求仅限工作区的文件系统工具姿态。 |
tools.exec.allowSecurity |
tools.exec.security 和每个代理的 exec 安全 |
仅允许 exec 安全模式,例如 deny 或 allowlist。 |
tools.exec.requireAsk |
tools.exec.ask 和每个代理的 exec 询问模式 |
要求审批姿态,例如 always。 |
tools.exec.allowHosts |
tools.exec.host 和每个代理的 exec 主机路由 |
仅允许 exec 主机路由模式,例如 sandbox。 |
tools.elevated.allow |
tools.elevated.enabled 和每个代理的提权姿态 |
设置为 false 以要求提权工具模式保持禁用。 |
tools.alsoAllow.expected |
tools.alsoAllow 和每个代理的 tools.alsoAllow |
要求精确的 alsoAllow 条目,并报告缺失或意外的附加工具授权。 |
tools.denyTools |
tools.deny 和 agents.entries.*.tools.deny |
要求配置的工具拒绝列表包含工具 id 或组,例如 group:runtime 和 group:fs。 |
工具要求使用与核心工具策略相同的组成员资格、别名和 * 匹配。例如,group:fs 包含 ls,group:runtime 包含
secrets,cron 解析为 automations,图像理解工具是
view_image。必需的拒绝列表必须覆盖必需组中的每个工具;
空列表不覆盖任何工具,拒绝 write 并不会拒绝 apply_patch。