Skip to content

SecretRef 凭据范围

本页面定义了 OpenClaw 中 SecretRef 凭据的权威范围。

范围说明:

  • 在范围内:严格由用户提供、OpenClaw 不自动生成也不轮换的凭据。
  • 不在范围内:运行时自动生成或轮换的凭据、OAuth 刷新令牌,以及类会话类产物。

支持的凭据

openclaw.json 目标字段(支持 secrets configure + secrets apply + secrets audit

  • models.providers.*.apiKey
  • models.providers.*.headers.*
  • skills.entries.*.apiKey
  • agents.defaults.memorySearch.remote.apiKey
  • agents.list[].memorySearch.remote.apiKey
  • talk.apiKey
  • talk.providers.*.apiKey
  • messages.tts.providers.*.apiKey
  • tools.web.fetch.firecrawl.apiKey
  • plugins.entries.brave.config.webSearch.apiKey
  • plugins.entries.google.config.webSearch.apiKey
  • plugins.entries.xai.config.webSearch.apiKey
  • plugins.entries.moonshot.config.webSearch.apiKey
  • plugins.entries.perplexity.config.webSearch.apiKey
  • plugins.entries.firecrawl.config.webSearch.apiKey
  • plugins.entries.tavily.config.webSearch.apiKey
  • tools.web.search.apiKey
  • tools.web.search.gemini.apiKey
  • tools.web.search.grok.apiKey
  • tools.web.search.kimi.apiKey
  • tools.web.search.perplexity.apiKey
  • gateway.auth.password
  • gateway.auth.token
  • gateway.remote.token
  • gateway.remote.password
  • cron.webhookToken
  • channels.telegram.botToken
  • channels.telegram.webhookSecret
  • channels.telegram.accounts.*.botToken
  • channels.telegram.accounts.*.webhookSecret
  • channels.slack.botToken
  • channels.slack.appToken
  • channels.slack.userToken
  • channels.slack.signingSecret
  • channels.slack.accounts.*.botToken
  • channels.slack.accounts.*.appToken
  • channels.slack.accounts.*.userToken
  • channels.slack.accounts.*.signingSecret
  • channels.discord.token
  • channels.discord.pluralkit.token
  • channels.discord.voice.tts.providers.*.apiKey
  • channels.discord.accounts.*.token
  • channels.discord.accounts.*.pluralkit.token
  • channels.discord.accounts.*.voice.tts.providers.*.apiKey
  • channels.irc.password
  • channels.irc.nickserv.password
  • channels.irc.accounts.*.password
  • channels.irc.accounts.*.nickserv.password
  • channels.bluebubbles.password
  • channels.bluebubbles.accounts.*.password
  • channels.feishu.appSecret
  • channels.feishu.encryptKey
  • channels.feishu.verificationToken
  • channels.feishu.accounts.*.appSecret
  • channels.feishu.accounts.*.encryptKey
  • channels.feishu.accounts.*.verificationToken
  • channels.msteams.appPassword
  • channels.mattermost.botToken
  • channels.mattermost.accounts.*.botToken
  • channels.matrix.password
  • channels.matrix.accounts.*.password
  • channels.nextcloud-talk.botSecret
  • channels.nextcloud-talk.apiPassword
  • channels.nextcloud-talk.accounts.*.botSecret
  • channels.nextcloud-talk.accounts.*.apiPassword
  • channels.zalo.botToken
  • channels.zalo.webhookSecret
  • channels.zalo.accounts.*.botToken
  • channels.zalo.accounts.*.webhookSecret
  • channels.googlechat.serviceAccount(通过同级 serviceAccountRef 兼容性例外)
  • channels.googlechat.accounts.*.serviceAccount(通过同级 serviceAccountRef 兼容性例外)

auth-profiles.json 目标字段(支持 secrets configure + secrets apply + secrets audit

  • profiles.*.keyReftype: "api_key"
  • profiles.*.tokenReftype: "token"

注意事项:

  • 认证配置文件(Auth-profile)计划目标需要提供 agentId
  • 计划条目以 profiles.*.key / profiles.*.token 为目标,并写入同级引用(keyRef / tokenRef)。
  • 认证配置文件引用包含在运行时解析和审计覆盖范围内。
  • 对于 SecretRef 管理的模型提供商,生成的 agents/*/agent/models.json 条目中,apiKey/header 字段存储的是非密钥标记(不是已解析的密钥值)。
  • 标记持久化以来源为权威:OpenClaw 从活跃源配置快照(解析前)写入标记,而非从运行时已解析的密钥值写入。
  • 关于 Web 搜索:
    • 在显式提供商模式下(已设置 tools.web.search.provider),只有所选提供商的密钥处于激活状态。
    • 在自动模式下(未设置 tools.web.search.provider),只有按优先级首先解析成功的提供商密钥处于激活状态。
    • 在自动模式下,未被选中的提供商引用在被选中前视为未激活状态。
    • 旧版 tools.web.search.* 提供商路径在兼容窗口期内仍可解析,但 SecretRef 的权威路径已统一为 plugins.entries.<plugin>.config.webSearch.*

不支持的凭据

以下凭据不在范围内:

  • commands.ownerDisplaySecret
  • channels.matrix.accessToken
  • channels.matrix.accounts.*.accessToken
  • hooks.token
  • hooks.gmail.pushToken
  • hooks.mappings[].sessionKey
  • auth-profiles.oauth.*
  • discord.threadBindings.*.webhookToken
  • whatsapp.creds.json

不支持原因:

  • 这些凭据属于自动生成、自动轮换、携带会话状态或 OAuth 持久类凭据,不适合通过只读的外部 SecretRef 解析机制管理。