Skip to content

OpenClaw Secrets Management, Complete Guide to Securing API Keys

June 22, 2026
Professional using OpenClaw Secrets Management for secure API keys

OpenClaw Secrets Management: The Complete Guide to Protecting Your API Keys and Credentials

OpenClaw has become a go-to platform for building multi-agent automation workflows. But there’s a problem most users don’t know about until it’s too late. By default, OpenClaw stores your API keys in plaintext. That means your OpenAI tokens, Telegram bot credentials, and other sensitive data sit in readable files on your system. Anyone with access to your machine can grab them. A backup sync could expose them. A misconfigured plugin could leak them.

This guide covers everything you need to know about OpenClaw secrets management. We’ll look at where your credentials actually live, how to move them out of plaintext storage, and how to connect external secret stores like HashiCorp Vault or AWS Secrets Manager. You’ll also learn about credential rotation, leak detection, and the specific CLI commands that make this all work. If you’re running OpenClaw on a VPS, sharing access with teammates, or connecting to paid APIs, this isn’t optional reading. It’s the difference between a secure setup and a costly mistake.

Where OpenClaw Stores Your Credentials by Default

Let’s start with the reality most OpenClaw users don’t think about. When you first set up OpenClaw and add your API keys, they go straight into configuration files on your system. No encryption. No special protection beyond basic file permissions.

The Default Storage Locations

OpenClaw keeps credentials in several places:

  • ~/.openclaw/openclaw.json – The main config file where most API keys end up
  • ~/.openclaw/agents/*/auth-profiles.json – Agent-specific authentication data
  • Related credential files – Various files created by plugins and integrations

These files typically have 600 permissions, meaning only the owner can read or write them. That sounds secure, but it’s not enough for real-world scenarios.

Why Plaintext Storage Creates Real Problems

Think about what happens when you back up your home directory to cloud storage. Your plaintext API keys go with it. Consider what happens when you share your OpenClaw config with a teammate. Your credentials are right there in the file.

There’s also the prompt injection angle. As noted in OpenClaw’s own documentation, “This is a prompt injection risk more than a config risk, but the consequence is the same: plaintext tokens in a file that might get backed up, synced, or indexed somewhere.”

Here are some specific scenarios where plaintext storage becomes dangerous:

  • VPS deployments – Other users on shared hosting might access your files
  • Git accidents – Accidentally committing config files to a repository
  • Backup leaks – Automated backups sending unencrypted credentials to cloud storage
  • Malware or intrusion – Attackers reading standard config file locations
  • Team sharing – Colleagues seeing credentials they shouldn’t have

The Real Cost of Exposed API Keys

When an OpenAI API key leaks, someone can rack up thousands of dollars in charges before you notice. A compromised Telegram bot token lets attackers impersonate your bot and potentially scam your users. Database credentials could expose customer data.

One power user who spent over 200 hours with OpenClaw noted: “Most of the pain new users experience isn’t a platform problem. It’s architecture, configuration, and habits.” Secrets management falls squarely into that category. The platform gives you the tools, but you need to configure them.

Understanding OpenClaw’s Native Secrets Management System

Here’s the good news. OpenClaw has a built-in secrets management system that most people never configure. The onboarding flow doesn’t require it, so users skip right past it. But once you understand how it works, moving your credentials to a secure setup is straightforward.

What Are SecretRefs in OpenClaw?

SecretRefs are OpenClaw’s way of referencing secrets without storing them directly in config files. Instead of putting your actual API key in the configuration, you put a reference that tells OpenClaw where to find the key at runtime.

Think of it like a pointer. The config file says “get the OpenAI key from this location” rather than containing the key itself. OpenClaw resolves these references when it starts up or when a workflow needs the credential.

Types of SecretRefs OpenClaw Supports

OpenClaw supports several types of secret references:

SecretRef Type Description Best For
env References environment variables Simple setups, CI/CD pipelines
file References external encrypted files Single-machine deployments
exec Runs a command to fetch secrets External secret managers
keychain System keychain integration macOS and Linux desktop use

Each type has its own resolution process and security characteristics. We’ll dig into each one later in this guide.

How SecretRef Resolution Works

When OpenClaw needs a credential, it goes through a resolution process. For gateway authentication, this happens before the gateway even starts. The system uses what’s called a “fail-fast gate,” which means if a required secret can’t be resolved, OpenClaw won’t start at all.

This is actually a good thing. You want to know immediately if your secrets setup is broken, not when a workflow fails at 2 AM.

The resolution order matters too. According to the documentation, “gateway.auth.token SecretRef is inactive for startup auth resolution when OPENCLAW_GATEWAY_TOKEN is set, because env token input wins for that runtime.” Environment variables take priority over SecretRef configurations in certain contexts.

Active vs Inactive SecretRefs

OpenClaw categorizes SecretRefs based on whether they’re actually needed for the current runtime:

  • Active – The SecretRef is part of the effective auth surface and must resolve successfully
  • Inactive – The SecretRef exists but isn’t needed for current operations

The system logs these entries with SECRETS_GATEWAY_AUTH_SURFACE and includes the reason for each classification. This visibility helps you understand exactly what’s happening with your credentials at runtime.

Setting Up Environment Variable References

Environment variables are the simplest way to move your API keys out of plaintext config files. They’re not the most secure option, but they’re a massive improvement over storing keys directly in JSON files.

Why Environment Variables Are Better Than Plaintext Config

Environment variables provide several advantages:

  • Not stored in files – They exist only in memory during the session
  • Easy to rotate – Change the variable without touching config files
  • CI/CD friendly – Most deployment systems handle env vars natively
  • Version control safe – No risk of accidentally committing credentials

The GitHub issue #7916 specifically requested this feature: “Allow referencing environment variables in config.” This is now fully supported in OpenClaw.

Configuring Env-Based SecretRefs

To reference an environment variable in your OpenClaw config, you use the env-template syntax:

${MCP_SERVER_API_KEY}

When OpenClaw starts, it looks for that environment variable and substitutes its value. If the variable isn’t set, the resolution fails and OpenClaw tells you exactly which variable is missing.

For MCP server configurations, the documentation notes: “Env-template refs like ${MCP_SERVER_API_KEY} and SecretRef objects are resolved during gateway activation before the MCP server process is spawned.”

Setting Environment Variables Securely

How you set environment variables matters for security. Here are the right and wrong ways:

Wrong approach (insecure):

  • Putting export commands in .bashrc or .zshrc
  • Storing them in files that get committed to git
  • Setting them in plaintext Docker Compose files

Right approach (more secure):

  • Using a secrets manager that exports to environment
  • Setting them in CI/CD pipeline configurations
  • Using encrypted .env files with tools like SOPS
  • Injecting them at runtime from a secure source

Environment Variables for Gateway Authentication

The gateway token is a special case. You can set OPENCLAW_GATEWAY_TOKEN as an environment variable, and it takes priority over any SecretRef configuration for that specific credential.

This override behavior is useful for development environments where you want to quickly test with a specific token without changing your configuration. But remember, the env token “wins” for that runtime, so your SecretRef becomes inactive.

Using External Encrypted Files with SOPS and Age

For stronger security than environment variables, OpenClaw supports external encrypted secrets files. This approach uses tools like SOPS (Secrets OPerationS) and age encryption to store credentials in encrypted form on disk.

How Encrypted Secrets Files Work

The concept is straightforward. You store your API keys in a file, but that file is encrypted. OpenClaw decrypts it at startup using a key you provide, then uses the secrets for the session. The secrets never exist as plaintext on disk.

GitHub issue #7916 described this option: “Support an encrypted secrets file that OpenClaw decrypts at startup.”

Setting Up Age Encryption

Age is a modern encryption tool that’s simpler than GPG. Here’s the basic workflow:

  1. Install age – Available through most package managers
  2. Generate a key pair – Creates a public key for encryption and private key for decryption
  3. Encrypt your secrets file – Use the public key to create an encrypted version
  4. Configure OpenClaw – Point to the encrypted file and provide the private key location

The private key should be stored securely, ideally in a hardware security module or a separate secrets manager. Never commit it to version control.

Integrating SOPS for Team Environments

SOPS adds features on top of age that make team collaboration easier. It supports:

  • Multiple encryption keys – Different team members can decrypt with their own keys
  • Partial encryption – Only secret values are encrypted, structure stays readable
  • Key rotation – Add or remove access without re-encrypting from scratch
  • Audit trails – Track who encrypted or decrypted files

For teams running OpenClaw, SOPS provides a good balance between security and usability.

File-Based SecretRef Configuration

To use encrypted files with OpenClaw, you configure file-type SecretRefs that point to your encrypted secrets. OpenClaw handles the decryption during startup.

The key naming is important. According to the documentation, “Use keys that satisfy the exec SecretRef id contract, such as openclaw/providers/openai/apiKey; env-var style keys with underscores are rejected before the resolver runs.”

Use forward slashes and camelCase, not underscores:

  • Good: openclaw/providers/openai/apiKey
  • Bad: OPENAI_API_KEY

System Keychain Integration for Desktop Users

If you’re running OpenClaw on a personal workstation rather than a server, system keychain integration offers excellent security with minimal friction. Your operating system’s built-in credential storage handles the encryption and access control.

macOS Keychain Integration

On macOS, OpenClaw can store and retrieve credentials from the system Keychain. This gives you:

  • Strong encryption – Protected by your login password and hardware security
  • Access control – Per-application permissions for credential access
  • Touch ID support – Biometric authentication before revealing secrets
  • iCloud sync – Optional synchronization across your Apple devices

The GitHub issue requesting this feature specified: “On macOS, use Keychain; on Linux, use libsecret/keyring.”

Linux Keyring Support

Linux systems have libsecret and the Secret Service API, which provide similar functionality to macOS Keychain. GNOME Keyring and KWallet both implement this API.

Key benefits on Linux:

  • Session locked – Secrets are locked when you lock your screen
  • Encrypted at rest – Protected by your login credentials
  • GUI management – Tools like Seahorse let you view and edit stored secrets

When Keychain Integration Makes Sense

System keychain is best for:

  • Personal workstations where you’re the only user
  • Development environments on your local machine
  • Situations where you want convenience without sacrificing security

It’s not ideal for:

  • Server deployments where there’s no GUI session
  • CI/CD pipelines that run headless
  • Team environments where multiple people need access

Configuring Keychain SecretRefs

To use keychain storage, you configure SecretRefs with the keychain type. OpenClaw queries the system’s secret service when it needs the credential.

First-time setup usually involves running a command that prompts you to store the secret in the keychain. After that, resolution happens automatically.

Connecting External Secret Stores

For production deployments and enterprise environments, external secret management systems provide the strongest security. OpenClaw’s exec SecretRefs let you integrate with tools like HashiCorp Vault, AWS Secrets Manager, or any system that can return secrets via command line.

How Exec SecretRefs Work

An exec SecretRef runs a command to fetch the secret. That command can call any external system you have access to. OpenClaw captures the output and uses it as the credential value.

This approach gives you maximum flexibility. Want to use HashiCorp Vault? Write a command that calls the Vault CLI. Need AWS Secrets Manager? Use the AWS CLI to fetch the secret. Have a custom internal secrets system? Call its API.

The allow-exec Flag

Because exec SecretRefs run arbitrary commands, they require explicit permission. You need to pass the --allow-exec flag when using commands that involve exec-type secrets.

From the documentation: “If your plan includes exec SecretRefs/providers, pass –allow-exec on both dry-run and write apply commands.”

This isn’t just a safety measure. It’s a security boundary that prevents accidental command execution.

HashiCorp Vault Integration

HashiCorp Vault is one of the most popular external secret stores. Here’s how the integration typically works:

  1. Install the Vault CLI on your OpenClaw server
  2. Authenticate to Vault using tokens, AppRole, or another method
  3. Configure exec SecretRefs that call vault kv get commands
  4. Test resolution using the dry-run option before going live

Vault provides features OpenClaw doesn’t have natively:

  • Dynamic secrets – Generate database credentials on demand
  • Lease management – Automatic credential expiration and renewal
  • Audit logging – Complete trail of who accessed what secrets
  • Policy enforcement – Fine-grained access control

AWS Secrets Manager Integration

If you’re running OpenClaw on AWS infrastructure, Secrets Manager is a natural fit. The integration follows the same pattern:

  1. Store secrets in AWS Secrets Manager
  2. Configure IAM permissions for your OpenClaw instance
  3. Create exec SecretRefs that call the AWS CLI
  4. Use instance roles to avoid storing AWS credentials

The AWS CLI command would look something like:

aws secretsmanager get-secret-value --secret-id openclaw/openai-key --query SecretString --output text

Other External Store Options

The exec SecretRef pattern works with any system that has a CLI or API:

  • Google Cloud Secret Manager – Use gcloud CLI
  • Azure Key Vault – Use az CLI
  • 1Password CLI – Good for teams already using 1Password
  • Doppler – Designed specifically for app secrets
  • Custom internal systems – Write a script that calls your internal API

OpenClaw Secrets CLI Commands in Detail

OpenClaw provides a comprehensive CLI for managing secrets. Understanding these commands is key to maintaining a healthy secrets setup.

The openclaw secrets audit Command

This command checks the health of your secrets configuration. It’s your first line of defense against misconfigurations.

Basic audit:

openclaw secrets audit

Audit with health check:

openclaw secrets audit --check

JSON output for scripting:

openclaw secrets audit --json

Include exec SecretRefs:

openclaw secrets audit --allow-exec

Run audits regularly, especially after making configuration changes. The --check flag gives you a pass/fail result that works well in CI/CD pipelines.

The openclaw secrets configure Command

This interactive command helps you set up and modify your secrets configuration. It walks you through the process step by step.

Interactive configuration:

openclaw secrets configure

Output plan to file:

openclaw secrets configure --plan-out /tmp/openclaw-secrets-plan.json

Apply changes immediately:

openclaw secrets configure --apply --yes

Configure providers only:

openclaw secrets configure --providers-only

Skip provider setup:

openclaw secrets configure --skip-provider-setup

Target specific agent:

openclaw secrets configure --agent ops

The --plan-out option is great for reviewing changes before applying them. It creates a JSON file describing what will change.

The openclaw secrets apply Command

Once you have a plan file, apply uses it to make changes to your configuration.

Dry run first:

openclaw secrets apply --from /tmp/openclaw-secrets-plan.json --dry-run

Dry run with exec refs:

openclaw secrets apply --from /tmp/openclaw-secrets-plan.json --dry-run --allow-exec

Apply for real:

openclaw secrets apply --from /tmp/openclaw-secrets-plan.json

Apply with exec refs:

openclaw secrets apply --from /tmp/openclaw-secrets-plan.json --allow-exec

Always run with --dry-run first. This shows you exactly what will change without making any modifications.

The openclaw secrets reload Command

After changing secrets, you need to reload them for the running gateway to pick up the changes.

Basic reload:

openclaw secrets reload

JSON output:

openclaw secrets reload --json

Target specific gateway:

openclaw secrets reload --url ws://127.0.0.1:18789 --token <token>

The reload command connects to the running gateway via WebSocket and triggers a re-resolution of all active SecretRefs.

Typical Workflow for Secrets Changes

The documentation shows a recommended workflow for making secrets changes:

  1. Audit current state: openclaw secrets audit --check
  2. Configure changes: openclaw secrets configure
  3. Dry run apply: openclaw secrets apply --from /tmp/openclaw-secrets-plan.json --dry-run
  4. Apply changes: openclaw secrets apply --from /tmp/openclaw-secrets-plan.json
  5. Verify: openclaw secrets audit --check
  6. Reload if needed: openclaw secrets reload

Gateway Configuration and Secrets Security

The OpenClaw gateway handles incoming requests and manages MCP server connections. It’s a critical component from a security perspective because it’s where credentials get used.

How Gateway Auth Resolves Secrets

When the gateway starts, it resolves all required SecretRefs before becoming operational. This happens in a specific sequence:

  1. Check for environment variables – These win if set
  2. Resolve active SecretRefs – Based on the configured providers
  3. Fail fast on errors – Any resolution failure stops startup
  4. Log the auth surface – Records which refs are active/inactive and why

The fail-fast approach means you’ll know immediately if something is wrong. You won’t find out later when a workflow fails.

MCP Server Secret Resolution

MCP servers often need their own credentials. These get resolved during gateway activation, before the server process starts.

From the documentation: “Env-template refs like ${MCP_SERVER_API_KEY} and SecretRef objects are resolved during gateway activation before the MCP server process is spawned.”

This means your MCP server never sees the SecretRef. It only receives the resolved credential value. That’s a security benefit since the server code doesn’t need to know about OpenClaw’s secrets system.

Gateway Config Write RPC Preflight

When you use the gateway’s config API to make changes, there’s a preflight check for secrets:

“Gateway config write RPC preflight (config.set / config.apply / config.patch) for active-surface SecretRef resolvability within the submitted config payload before persisting edits.”

This means the gateway tests that any new SecretRefs can actually be resolved before saving your config changes. If a SecretRef in your new config can’t be resolved, the write fails and your existing config stays intact.

Quickstart SecretRef Reuse

If you’re going through OpenClaw’s quickstart flow with existing SecretRef configurations, there’s special handling:

“Quickstart reuse path: when gateway.auth.token is already a SecretRef, onboarding resolves it before probe/dashboard bootstrap (for env, file, and exec refs) using the same fail-fast gate.”

This ensures your existing secrets setup carries through the onboarding process smoothly.

Rotating Credentials and Detecting Leaks

Even with perfect secrets management, credentials need to be rotated periodically. And sometimes, despite best efforts, leaks happen. You need processes for both.

Why Credential Rotation Matters

Regular rotation limits the damage from undetected leaks. If a credential gets exposed but you rotate it monthly, the window of vulnerability is capped at 30 days.

Rotation also helps with:

  • Access control – Former team members lose access automatically
  • Compliance – Many standards require periodic rotation
  • Limiting blast radius – Old credentials can’t be used for long-term access

Safe Rotation Process for OpenClaw

Rotating credentials in OpenClaw requires coordination between your secrets store and the running system:

  1. Generate new credential in your provider (OpenAI, Telegram, etc.)
  2. Update the secret store (env var, encrypted file, or external manager)
  3. Reload secrets: openclaw secrets reload
  4. Test that everything works with the new credential
  5. Revoke the old credential only after confirming the new one works

Don’t revoke the old credential first. That causes downtime. Always have the new credential working before killing the old one.

Detecting Credential Leaks

How do you know if your credentials have been exposed? Several approaches:

Provider monitoring:

  • OpenAI shows usage in their dashboard. Unexpected spikes suggest compromise.
  • Most cloud providers have billing alerts. Set them up.
  • Telegram bot activity logs show all interactions.

Secret scanning tools:

  • GitHub has built-in secret scanning that alerts on exposed credentials
  • TruffleHog scans git history for secrets
  • GitLeaks checks both current and historical commits

File integrity monitoring:

  • Tools like AIDE or Tripwire can alert when config files change unexpectedly
  • This catches unauthorized access to your OpenClaw configuration

What to Do When a Leak Happens

If you discover a credential has been exposed:

  1. Revoke immediately – Don’t wait, kill the compromised credential now
  2. Generate new credential – Create a replacement
  3. Update OpenClaw – Point to the new credential
  4. Reload: openclaw secrets reload
  5. Investigate – Figure out how the leak happened
  6. Fix the root cause – Prevent it from happening again
  7. Check for damage – Review logs for unauthorized usage

Speed matters here. Every minute a compromised credential is active is a minute someone can misuse it.

Security Considerations for Multi-Agent Architectures

OpenClaw excels at multi-agent automation workflows. But more agents mean more attack surface. You need to think about secrets management in the context of your overall architecture.

Agent-Specific Credentials

Different agents might need different credentials. The agent-specific auth-profiles.json files we mentioned earlier handle this. But from a security standpoint, consider:

  • Least privilege – Each agent should only have credentials for what it needs
  • Isolation – Compromise of one agent shouldn’t expose credentials for others
  • Audit trails – Know which agent used which credential when

Using different API keys for different agents makes it easier to track usage and revoke access surgically if needed.

Drawing the Agent Graph First

The power user guide emphasizes: “Before you open the workflow builder, sketch the agent graph on paper or a whiteboard.”

This applies to secrets too. Before building your agents, map out:

  • Which agent needs which external services
  • What credentials each service requires
  • How those credentials should be stored and accessed
  • Who should be able to manage each credential

Planning this upfront prevents the “web of connected agents where no one knows what calls what or why” that the guide warns about.

Sub-Agent Credential Inheritance

When agents call sub-agents, credential handling gets tricky. Does the sub-agent use the parent’s credentials? Its own? Some combination?

OpenClaw’s model keeps credentials at the agent level. A sub-agent has its own auth profile. This provides good isolation but requires more setup.

For security, this is the right approach. You don’t want credential escalation where a limited agent can access more credentials by calling a privileged sub-agent.

Prompt Injection and Credential Theft

Multi-agent systems face prompt injection risks. A malicious prompt could try to trick an agent into revealing credentials or making unauthorized API calls.

The core OpenClaw documentation acknowledges: “This is a prompt injection risk more than a config risk, but the consequence is the same.”

Mitigations include:

  • Input sanitization – Clean user inputs before passing to agents
  • Output filtering – Check that agent outputs don’t contain credentials
  • Rate limiting – Cap the number and cost of API calls
  • Sandboxing – Run agents with minimal system permissions

Building a Complete Secrets Management Strategy

Individual techniques are useful, but you need an overall strategy. Here’s how to put everything together.

Choosing the Right Approach for Your Situation

The best secrets management approach depends on your context:

Scenario Recommended Approach
Personal workstation, single user System keychain integration
Local development, team of developers SOPS encrypted files in git
VPS deployment, solo operator Environment variables plus encrypted backup
Production server, organization External secret manager (Vault, AWS SM)
CI/CD pipelines Pipeline’s native secrets with env injection
Kubernetes deployment K8s secrets plus external secrets operator

Defense in Depth

Don’t rely on a single security measure. Layer multiple protections:

  1. File permissions – Even for encrypted files, restrict who can read them
  2. Encryption at rest – Use encrypted secrets files or an encrypted filesystem
  3. Encryption in transit – TLS for any network communication of secrets
  4. Access control – Limit who can access the machine running OpenClaw
  5. Audit logging – Track all credential access and changes
  6. Rotation – Regular credential changes limit exposure windows
  7. Monitoring – Detect unusual credential usage patterns

Documentation and Runbooks

Your secrets management setup should be documented. Not the secrets themselves, but:

  • Where secrets are stored and why that location was chosen
  • How to add, modify, or remove secrets
  • The rotation schedule and process
  • What to do if a leak is suspected
  • Who has access and how access is granted/revoked

When there’s an incident at 2 AM, you don’t want to be figuring this out from scratch.

Regular Security Reviews

Schedule periodic reviews of your secrets management:

  • Monthly: Run openclaw secrets audit --check and review results
  • Quarterly: Rotate credentials even if not required
  • Annually: Full review of strategy, tools, and access controls
  • After incidents: Post-mortem and process improvements

Handling Team Growth

As your team grows, secrets management gets harder. Think ahead about:

  • Onboarding – How do new team members get access to needed secrets?
  • Offboarding – How do you ensure departing members lose access?
  • Role changes – How do you adjust access when responsibilities change?
  • Auditing – How do you track who accessed what?

External secret managers like Vault handle this well. File-based approaches require more manual process.

Balancing Security and Usability

Perfect security that’s too inconvenient gets bypassed. People will store credentials in plaintext because “the secure way takes too long.”

Find the right balance:

  • Make the secure path the easy path
  • Automate repetitive security tasks
  • Provide good tooling and documentation
  • Don’t require excessive approvals for routine operations

A slightly less secure approach that people actually use beats a theoretically perfect approach that everyone works around.

Conclusion

OpenClaw secrets management isn’t complicated, but it does require deliberate action. The default plaintext storage is a genuine risk for anyone running on shared infrastructure or connecting to paid APIs. Moving to environment variables, encrypted files, or external secret stores brings your setup up to production-grade security.

Start with an audit of your current configuration. Identify which credentials are most sensitive and migrate those first. Build habits around rotation and monitoring. Your future self will thank you when you haven’t had to deal with a costly credential leak.

Frequently Asked Questions About OpenClaw Secrets Management

Where does OpenClaw store API keys by default?

OpenClaw stores API keys in plaintext in several configuration files, primarily ~/.openclaw/openclaw.json and ~/.openclaw/agents/*/auth-profiles.json. These files have 600 permissions by default, but the credentials are not encrypted.
Who should use OpenClaw’s secrets management features?

Anyone running OpenClaw on a VPS, shared hosting, or in team environments should use secrets management. It’s also critical for anyone connecting to paid APIs like OpenAI where exposed credentials could lead to unexpected charges.
What types of SecretRefs does OpenClaw support?

OpenClaw supports four main types of SecretRefs: env (environment variables), file (external encrypted files), exec (commands that fetch secrets from external systems), and keychain (system keychain integration on macOS and Linux).
What is the –allow-exec flag and when do I need it?

The –allow-exec flag is required when your secrets configuration includes exec SecretRefs that run external commands. You must pass this flag on both dry-run and actual apply commands. It’s a security measure to prevent accidental command execution.
How do I check if my OpenClaw secrets are configured correctly?

Run openclaw secrets audit –check to verify your configuration. This command checks that all active SecretRefs can be resolved and reports any issues. Use –json for machine-readable output and –allow-exec if you have exec-type SecretRefs.
Can I use HashiCorp Vault or AWS Secrets Manager with OpenClaw?

Yes. OpenClaw’s exec SecretRefs let you integrate with any external secret store that has a command-line interface. You configure a SecretRef that runs a command to fetch the secret from Vault, AWS Secrets Manager, or other external systems.
What happens if a SecretRef can’t be resolved at startup?

OpenClaw uses a fail-fast approach. If an active SecretRef can’t be resolved during gateway startup, OpenClaw won’t start. It will report which SecretRef failed and why. This prevents running with missing or broken credentials.
How do I rotate credentials in OpenClaw safely?

First, generate a new credential with your provider. Update your secret store (env var, encrypted file, or external manager). Run openclaw secrets reload to pick up the change. Test that everything works with the new credential. Only then revoke the old credential.
What naming convention should I use for SecretRef keys?

Use forward slashes and camelCase, like openclaw/providers/openai/apiKey. Env-var style keys with underscores are rejected. The documentation notes that keys must satisfy the exec SecretRef id contract.
Why does the OPENCLAW_GATEWAY_TOKEN environment variable override my SecretRef?

By design, environment token input takes priority for gateway auth resolution. When OPENCLAW_GATEWAY_TOKEN is set, the gateway.auth.token SecretRef becomes inactive. This allows quick overrides in development without changing configuration files.