Validate OpenClaw Secrets Plans: Enforce Configuration Rules
Managing secrets can feel like walking through a minefield. One wrong path or a typo in your config, and your whole setup might break. To avoid these headaches, openclaw secrets apply follows a strict contract to make sure your configuration stays clean and functional.
This page defines the strict contract enforced by openclaw secrets apply. If a target does not match these rules, the apply process fails before any configuration is changed.
Plan file shape
Section titled “Plan file shape”When you use openclaw secrets apply --from <plan.json>, the tool expects a targets array. Here is what that structure looks like:
{ version: 1, protocolVersion: 1, targets: [ { type: "models.providers.apiKey", path: "models.providers.openai.apiKey", pathSegments: ["models", "providers", "openai", "apiKey"], providerId: "openai", ref: { source: "env", provider: "default", id: "OPENAI_API_KEY" }, }, { type: "auth-profiles.api_key.key", path: "profiles.openai:default.key", pathSegments: ["profiles", "openai:default", "key"], agentId: "main", ref: { source: "env", provider: "default", id: "OPENAI_API_KEY" }, }, ],}Supported target scope
Section titled “Supported target scope”Plan targets are accepted for supported credential paths in:
Target type behavior
Section titled “Target type behavior”The general rule is that target.type must be recognized and must match the normalized target.path shape.
Compatibility aliases remain accepted for existing plans:
models.providers.apiKeyskills.entries.apiKeychannels.googlechat.serviceAccount
Path validation rules
Section titled “Path validation rules”To keep your configuration safe, each target is validated with these rules:
typemust be a recognized target type.pathmust be a non-empty dot path.pathSegmentscan be omitted. If you provide it, it must normalize to exactly the same path aspath.- Forbidden segments are rejected:
__proto__,prototype,constructor. - The normalized path must match the registered path shape for the target type.
- If
providerIdoraccountIdis set, it must match the id encoded in the path. auth-profiles.jsontargets requireagentId.- When creating a new
auth-profiles.jsonmapping, includeauthProfileProvider.
Failure behavior
Section titled “Failure behavior”If a target fails validation, the apply process exits immediately with an error. You might see something like this:
Invalid plan target path for models.providers.apiKey: models.providers.openai.baseUrlNo writes are committed for an invalid plan, so you don’t have to worry about partial updates.
Runtime and audit scope notes
Section titled “Runtime and audit scope notes”- Ref-only
auth-profiles.jsonentries (keyRef/tokenRef) are included in runtime resolution and audit coverage. secrets applywrites supportedopenclaw.jsontargets, supportedauth-profiles.jsontargets, and optional scrub targets.
Operator checks
Section titled “Operator checks”It is a good idea to validate your plan without actually writing any changes first. You can use the --dry-run flag for this.
# Validate plan without writesopenclaw secrets apply --from /tmp/openclaw-secrets-plan.json --dry-run
# Then apply for realopenclaw secrets apply --from /tmp/openclaw-secrets-plan.jsonIf the apply fails with an invalid target path message, you should regenerate the plan with openclaw secrets configure or fix the target path to a supported shape.
Related docs
Section titled “Related docs”Next Steps
Section titled “Next Steps”- Learn more about Secrets Management
- Explore the CLI
secretscommands
Need more help? Check out the AI Setup Assistant.
OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.