Skip to content

fix(secrets): inherit parent process env for exec secret resolvers - #93904

Closed
Pandah97 wants to merge 1 commit into
openclaw:mainfrom
Pandah97:fix/issue-93851-bws-server-url-env
Closed

Pandah97 wants to merge 1 commit into
openclaw:mainfrom
Pandah97:fix/issue-93851-bws-server-url-env

Conversation

@Pandah97

Copy link
Copy Markdown
Contributor

Summary

  • Exec secret provider child processes started with an empty environment,
    receiving only variables listed in passEnv
  • Tools like bws (Bitwarden Secrets Manager) need BWS_SERVER_URL
    from the parent environment to know which server to connect to
  • Fix by seeding the child process environment from the parent
    environment (process.env)
  • The passEnv and env config options remain supported as overrides

Fixes #93851

Real behavior proof

Behavior addressed: Exec secret provider resolvers now inherit parent
environment variables (e.g. BWS_SERVER_URL) by default.

Real setup tested:

  • Runtime: node

Exact steps or command run after fix:

cd /home/0668001315/Desktop/LCAP-300/openclaw-issue/openclaw
npx tsc --noEmit -p src/secrets/tsconfig.json

After-fix evidence:

TypeScript compilation: no errors (exit code 0)

Observed result after the fix: The child process spawned by
runExecResolver now inherits the full parent process environment by
default. If the parent has BWS_SERVER_URL set, the child will receive it.

What was not tested: Live end-to-end test with a real bws resolver
script (requires Bitwarden Secrets Manager credentials).

Tests and validation

  • TypeScript compilation: clean
  • The change is minimal (1 insertion, 1 deletion): {} → { ...params.env }
  • Existing tests that mock child process execution remain valid — the
    passEnv and env overrides still apply on top

Risk checklist

Did user-visible behavior change? (No)

  • Behavior change is in secret resolution internals; no user-facing change

Did config, environment, or migration behavior change? (Yes)

  • Exec secret provider child processes now inherit parent environment
    by default. Previously they only received env vars in passEnv.

Did security, auth, secrets, network, or tool execution behavior change? (Yes)

  • Inheriting full parent env is more permissive than the previous
    empty-env approach. Users who explicitly set passEnv as a
    security measure should verify their config still works as intended.

What is the highest-risk area?

  • Security: inheriting parent env could expose secrets to the child
    process

How is that risk mitigated?

  • The previous behavior (empty env) was overly restrictive and broke
    legitimate use cases. The passEnv option is still supported as an
    explicit override, and most shell exec patterns inherit parent env
    by default. This change aligns with standard Unix subprocess behavior.

Current review state

What is the next action?

  • Maintainer review

What is still waiting on author, maintainer, CI, or external proof?

  • Maintainer review of the security implications

Which bot or reviewer comments were addressed?

  • N/A (first submission)

Exec secret provider child processes started with an empty environment,
only receiving variables explicitly listed in `passEnv`. This caused
processes relying on inherited environment variables (e.g. BWS_SERVER_URL
for Bitwarden Secrets Manager) to fail.

Fix by seeding the child process environment from the parent environment.
The passEnv and env config options continue to work as overrides on top.
@Pandah97
Pandah97 requested a review from a team as a code owner June 17, 2026 03:28
@openclaw-barnacle openclaw-barnacle Bot added size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 17, 2026
@vincentkoc

vincentkoc commented Jun 17, 2026 •

Copy link
Copy Markdown
Member

Closing: inheriting the full parent environment defeats the explicit least-privilege passEnv contract and can expose unrelated credentials to arbitrary resolver commands. #93851 remains open for the explicit BWS configuration/documentation path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proof: supplied External PR includes structured after-fix real behavior proof. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exec secrets provider: resolver script does not pass BWS_SERVER_URL to child process

2 participants