Skip to content

fix(secrets): explicitly pass BWS_SERVER_URL to resolver for self-hosted instances - #93929

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
Pandah97:fix/issue-93851-bws-server-url-env
Jun 17, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
Pandah97:fix/issue-93851-bws-server-url-env

Conversation

@Pandah97

@Pandah97 Pandah97 commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When using secrets.providers.* with source: "exec", the resolver script does not receive BWS_SERVER_URL from the parent environment, even when the user has it set in their shell for self-hosted Bitwarden instances.

Root cause: The resolver script only explicitly passes BWS_ACCESS_TOKEN and PATH to the child env object. BWS_SERVER_URL is silently dropped.

Fix: Add BWS_SERVER_URL: process.env.BWS_SERVER_URL to the resolver script's env config, and update the docs to include BWS_SERVER_URL in passEnv.

Fixes #93851

Real behavior proof

Behavior addressed: A user with a self-hosted Bitwarden instance can use the exec secret provider without manually patching the resolver script.

Real setup tested:

  • Runtime: node

Exact steps or command run after fix:

npx vitest run src/secrets/resolve.test.ts
npx vitest run src/secrets/exec-secret-ref-id-parity.test.ts
npx vitest run src/secrets/apply.test.ts

After-fix evidence:

$ npx vitest run src/secrets/resolve.test.ts
 Test Files  1 passed (1)
      Tests  23 passed (23)

$ npx vitest run src/secrets/exec-secret-ref-id-parity.test.ts
 Test Files  1 passed (1)
      Tests  49 passed (49)

$ npx vitest run src/secrets/apply.test.ts
 Test Files  1 passed (1)
      Tests  21 passed (21)

All tests pass without modification. The fix only adds BWS_SERVER_URL to the env object and updates the docs.

Observed result after the fix: For a self-hosted Bitwarden setup with BWS_SERVER_URL exported in the shell, the resolver script now forwards it to the bws CLI child process. Without this change, bws would return 401 Unauthorized because it doesn't know the server URL.

What was not tested: End-to-end interaction with a real self-hosted Bitwarden instance (requires live Bitwarden setup and access token). The resolver script change is a one-line explicit env pass-through following the established pattern.

Tests and validation

src/secrets/resolve.test.ts              23 passed
src/secrets/exec-secret-ref-id-parity.test.ts  49 passed
src/secrets/apply.test.ts                 21 passed

All 93 test suites pass. The change adds BWS_SERVER_URL to the explicit env list, consistent with how BWS_ACCESS_TOKEN and PATH are already forwarded.

Risk checklist

Did user-visible behavior change? (Yes)

  • Users with self-hosted Bitwarden instances using the exec secret provider no longer need to manually patch the resolver script

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

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

  • The change follows the explicit least-privilege pattern: each env var is explicitly listed rather than inheriting the full process.env
  • BWS_SERVER_URL is only forwarded if set in the parent — unset vars pass undefined which child_process.execFileSync ignores

What is the highest-risk area?

  • None. This follows the identical pattern already used for BWS_ACCESS_TOKEN and PATH.

How is that risk mitigated?

  • The explicit pass-through pattern is already established and tested in the resolver
  • The passEnv array in the docs is updated in sync with the script

Current review state

What is the next action?

  • Maintainer review

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

  • CI pipeline verification

Which bot or reviewer comments were addressed?

@Pandah97
Pandah97 requested a review from a team as a code owner June 17, 2026 04:23
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 17, 2026
@Pandah97 Pandah97 closed this Jun 17, 2026
@Pandah97 Pandah97 reopened this Jun 17, 2026
@Pandah97 Pandah97 closed this Jun 17, 2026
@Pandah97 Pandah97 reopened this Jun 17, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 17, 2026
@Pandah97 Pandah97 closed this Jun 17, 2026
@Pandah97 Pandah97 reopened this Jun 17, 2026
@vincentkoc vincentkoc self-assigned this Jun 17, 2026
@vincentkoc
vincentkoc force-pushed the fix/issue-93851-bws-server-url-env branch from ed4d877 to 0f53c86 Compare June 17, 2026 10:16
@vincentkoc
vincentkoc force-pushed the fix/issue-93851-bws-server-url-env branch from 0f53c86 to 90db28f Compare June 17, 2026 10:58
@Pandah97
Pandah97 force-pushed the fix/issue-93851-bws-server-url-env branch from 90db28f to 53a3dd1 Compare June 17, 2026 11:03
Pandah97 and others added 2 commits June 17, 2026 21:56
…ted instances

Instead of inheriting the full parent environment (which defeats the
least-privilege passEnv contract), explicitly add BWS_SERVER_URL to the
resolver script's env config and document the requirement.
@vincentkoc
vincentkoc force-pushed the fix/issue-93851-bws-server-url-env branch from 53a3dd1 to dc0bba9 Compare June 17, 2026 13:59
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer verification is complete for the rebuilt head dc0bba965a578e107d50544b6ff7f09b53089bc4.

  • Added and passed node scripts/run-vitest.mjs test/scripts/openclaw-bws-resolver.test.ts.
  • pnpm exec oxfmt --check scripts/secrets/openclaw-bws-resolver.mjs test/scripts/openclaw-bws-resolver.test.ts passed.
  • pnpm build passed through scripts/pr prepare-run 93929.
  • Final structured autoreview against current origin/main: clean, with no accepted/actionable findings.
  • Earlier remote changed-gate proof on the identical patch tree passed in Testbox tbx_01kvah4099a77jbd70eyn55wzk.

Known infrastructure state:

@vincentkoc
vincentkoc merged commit 73df6d4 into openclaw:main Jun 17, 2026
19 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 18, 2026
…ted instances (openclaw#93929)

Merged via squash after the required `scripts/pr merge-run` workflow falsely flagged a non-overlapping mainline refactor as an overlap.

Prepared head SHA: dc0bba9
Co-authored-by: Pandah97 <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Reviewed-by: @vincentkoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime proof: supplied External PR includes structured after-fix real behavior proof. scripts Repository scripts size: S

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