快速开始
SecretRef 凭证表层
本页定义了规范的 SecretRef 凭据范围:哪些凭据字段可以接受 SecretRef(由环境变量、文件或命令执行支持的引用),而不是原始机密值。
范围:
- 范围内:严格限于由用户提供、且 OpenClaw 不会生成或轮换的凭据。
- 范围外:运行时生成或轮换的凭据、OAuth 刷新材料以及类似会话的产物。
以下列表根据源目标注册表生成,并在 CI 中与 docs/reference/secretref-user-supplied-credentials-matrix.json 进行核对;请勿手动编辑条目。
支持的凭据
openclaw.json 目标(secrets configure + secrets apply + secrets audit)
models.providers.*.apiKeymodels.providers.*.headers.*models.providers.*.request.auth.tokenmodels.providers.*.request.auth.valuemodels.providers.*.request.headers.*models.providers.*.request.proxy.tls.camodels.providers.*.request.proxy.tls.certmodels.providers.*.request.proxy.tls.keymodels.providers.*.request.proxy.tls.passphrasemodels.providers.*.request.tls.camodels.providers.*.request.tls.certmodels.providers.*.request.tls.keymodels.providers.*.request.tls.passphraseskills.entries.*.apiKeyagents.defaults.memorySearch.remote.apiKeyagents.list[].tts.providers.*.apiKeyagents.list[].memorySearch.remote.apiKeytalk.providers.*.apiKeytalk.realtime.providers.*.apiKeymessages.tts.providers.*.apiKeytools.web.fetch.firecrawl.apiKeyplugins.entries.acpx.config.mcpServers.*.env.*plugins.entries.brave.config.webSearch.apiKeyplugins.entries.codex.config.appServer.authTokenplugins.entries.codex.config.appServer.headers.*plugins.entries.exa.config.webSearch.apiKeyplugins.entries.google-meet.config.realtime.providers.*.apiKeyplugins.entries.google.config.webSearch.apiKeyplugins.entries.xai.config.webSearch.apiKeyplugins.entries.moonshot.config.webSearch.apiKeyplugins.entries.perplexity.config.webSearch.apiKeyplugins.entries.firecrawl.config.webSearch.apiKeyplugins.entries.minimax.config.webSearch.apiKeyplugins.entries.tavily.config.webSearch.apiKeyplugins.entries.parallel.config.webSearch.apiKeyplugins.entries.voice-call.config.realtime.providers.*.apiKeyplugins.entries.voice-call.config.streaming.providers.*.apiKeyplugins.entries.voice-call.config.tts.providers.*.apiKeyplugins.entries.voice-call.config.twilio.authTokentools.web.search.*.apiKeytools.web.search.apiKeygateway.auth.passwordgateway.auth.tokengateway.remote.tokengateway.remote.passwordcron.webhookTokenchannels.telegram.botTokenchannels.telegram.webhookSecretchannels.telegram.accounts.*.botTokenchannels.telegram.accounts.*.webhookSecretchannels.slack.botTokenchannels.slack.appTokenchannels.slack.relay.authTokenchannels.slack.userTokenchannels.slack.signingSecretchannels.slack.accounts.*.botTokenchannels.slack.accounts.*.appTokenchannels.slack.accounts.*.relay.authTokenchannels.slack.accounts.*.userTokenchannels.slack.accounts.*.signingSecretchannels.sms.authTokenchannels.sms.accounts.*.authTokenchannels.discord.tokenchannels.discord.pluralkit.tokenchannels.discord.voice.tts.providers.*.apiKeychannels.discord.accounts.*.tokenchannels.discord.accounts.*.pluralkit.tokenchannels.discord.accounts.*.voice.tts.providers.*.apiKeychannels.irc.passwordchannels.irc.nickserv.passwordchannels.irc.accounts.*.passwordchannels.irc.accounts.*.nickserv.passwordchannels.feishu.appSecretchannels.feishu.encryptKeychannels.feishu.verificationTokenchannels.feishu.accounts.*.appSecretchannels.feishu.accounts.*.encryptKeychannels.feishu.accounts.*.verificationTokenchannels.qqbot.clientSecretchannels.qqbot.accounts.*.clientSecretchannels.msteams.appPasswordchannels.mattermost.botTokenchannels.mattermost.accounts.*.botTokenchannels.matrix.accessTokenchannels.matrix.passwordchannels.matrix.accounts.*.accessTokenchannels.matrix.accounts.*.passwordchannels.nextcloud-talk.botSecretchannels.nextcloud-talk.apiPasswordchannels.nextcloud-talk.accounts.*.botSecretchannels.nextcloud-talk.accounts.*.apiPasswordchannels.zalo.botTokenchannels.zalo.webhookSecretchannels.zalo.accounts.*.botTokenchannels.zalo.accounts.*.webhookSecretchannels.googlechat.serviceAccount通过同级serviceAccountRef(兼容性例外)channels.googlechat.accounts.*.serviceAccount通过同级serviceAccountRef(兼容性例外)
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"时不受支持)
注意:
- 身份验证配置文件计划目标需要
agentId;计划条目以profiles.*.key/profiles.*.token为目标,并写入同级引用(keyRef/tokenRef)。身份验证配置文件引用包含在运行时解析和审计覆盖范围内。 - 在
openclaw.json中,SecretRef 必须使用结构化对象,例如{"source":"env","provider":"default","id":"DISCORD_BOT_TOKEN"}。SecretRef 凭据路径会拒绝旧版secretref-env:<ENV_VAR>标记字符串;请运行openclaw doctor --fix迁移有效标记。 - OAuth 策略防护:
auth.profiles.<id>.mode = "oauth"不能与该配置文件的 SecretRef 输入结合使用。违反此策略时,启动/重新加载和身份验证配置文件解析会立即失败。 - 对于由 SecretRef 管理的模型提供商,生成的
agents/*/agent/models.json条目会为apiKey/标头范围持久化非机密标记,而不是解析后的机密值。标记持久化以源为准:OpenClaw 从当前生效的源配置快照(解析前)写入标记,而不是从解析后的运行时机密值写入。 - 对于 Web 搜索:在显式提供商模式下(已设置
tools.web.search.provider),只有所选提供商的密钥处于活动状态。在自动模式下(未设置tools.web.search.provider),只有按优先级解析成功的第一个提供商密钥处于活动状态,未选中的提供商引用在被选中前视为非活动状态。在兼容窗口期内,旧版tools.web.search.*提供商路径仍会解析,但规范的 SecretRef 范围为plugins.entries.<plugin>.config.webSearch.*。
不支持的凭据
这些凭据属于生成型、轮换型、承载会话或 OAuth 持久型类别,不适合只读的外部 SecretRef 解析:
commands.ownerDisplaySecrethooks.tokenhooks.gmail.pushTokenhooks.mappings[].sessionKeyauth-profiles.oauth.*channels.discord.threadBindings.webhookTokenchannels.discord.accounts.*.threadBindings.webhookTokenchannels.whatsapp.creds.jsonchannels.whatsapp.accounts.*.creds.json
相关内容
Was this useful?