跳转到内容

SecretRef 凭据定义

本页面定义了规范的 SecretRef 凭证范围。

范围意图:

  • 范围内:严格限于 OpenClaw 不创建或轮换的用户提供的凭证。
  • 范围外:运行时创建或轮换的凭证、OAuth 刷新材料以及类似会话的工件。

openclaw.json 目标 (secrets configure + secrets apply + secrets audit)

Section titled “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.x_search.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.accessToken
  • channels.matrix.password
  • channels.matrix.accounts.*.accessToken
  • 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
  • 通过同级 serviceAccountRefchannels.googlechat.serviceAccount(兼容性例外)
  • 通过同级 serviceAccountRefchannels.googlechat.accounts.*.serviceAccount(兼容性例外)

auth-profiles.json 目标(secrets configure + secrets apply + secrets audit

Section titled “auth-profiles.json 目标(secrets configure + secrets apply + secrets audit)”
  • profiles.*.keyRef (type: "api_key";当 auth.profiles.<id>.mode = "oauth" 时不支持)
  • profiles.*.tokenRef (type: "token";当 auth.profiles.<id>.mode = "oauth" 时不支持)

注意事项:

  • Auth-profile 计划目标需要 agentId
  • 计划条目目标 profiles.*.key / profiles.*.token 并写入同级引用 (keyRef / tokenRef)。
  • Auth-profile 引用包含在运行时解析和审计覆盖范围内。
  • OAuth 策略守卫:auth.profiles.<id>.mode = "oauth" 不能与该配置文件的 SecretRef 输入结合使用。当违反此策略时,启动/重新加载和 auth-profile 解析会快速失败。
  • 对于 SecretRef 托管的模型提供商,生成的 agents/*/agent/models.json 条目会为 apiKey/header 表面持久化非机密标记(而非已解析的机密值)。
  • 标记持久化以源为准:OpenClaw 从活动源配置快照(解析前)写入标记,而不是从已解析的运行时机密值写入。
  • 对于网络搜索:
    • 在显式提供商模式(设置了 tools.web.search.provider)下,仅所选的提供商密钥处于活动状态。
    • 在自动模式(未设置 tools.web.search.provider)下,仅按优先级解析的第一个提供商密钥处于活动状态。
    • 在自动模式下,未选定的提供商引用在被选中之前被视为非活动状态。
    • 传统的 tools.web.search.* 提供商路径在兼容性窗口期间仍然解析,但规范的 SecretRef 表面是 plugins.entries.<plugin>.config.webSearch.*

范围之外的凭据包括:

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

基本原理:

  • 这些凭据是已创建、已轮换、承载会话或 OAuth 持久类,不适合只读的外部 SecretRef 解析。