Skip to content

[Feature]: support SecretRef for env.vars #72390

@edlevin6612

Description

@edlevin6612

Summary

Include SecretRef support for openclaw.json env block to allow a workflow where secrets stored as environment variables can be resolved at runtime (e.g. from 1Password)

Problem to solve

Currently, secretRef is not supported for the env block in openclaw.json. This makes setting/passing environment variables where the value is not static but rather derived dynamically (e.g. from 1Password) difficult.

Proposed solution

Extend SectrerRef support for the env block, similar to API keys:

  "secrets": {
    "providers": {
      "default": { "source": "env" },
      "op-my-sectet": {
        "source": "exec",
        "command": "/usr/bin/op",
        "allowInsecurePath": true,
        "args": ["read", "--no-newline", "op://MyVault/MySecret/credential"],
        "passEnv": ["HOME", "OP_SERVICE_ACCOUNT_TOKEN"],
        "jsonOnly": false
      },
  "env": {
    "vars": {
      "MY_SECRET_VAR": { "source": "exec", "provider": "op-my-secret", "id": "value" }
    }

Alternatives considered

Alternative is to define environment variables in .env as static values but that is counterproductive to having all secrets stored in an external values like 1Password. One can then have Gateway and Model tokens/passwords in 1Password but then still have to keep other secrets (e.g. ones used by Skills requiring environment vars) on the filesystem.

Impact

Someone wishing to offload all secret storage to an external secret management system for a better security posture.

Example: https://prokopov.me/posts/securing-openclaw-with-1password/

Evidence/examples

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestimpact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions