fix(acp): strip provider auth env for child ACP processes#42250
fix(acp): strip provider auth env for child ACP processes#42250Takhoffman merged 7 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9bcf2c8b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Greptile SummaryThis PR adds a security hardening layer to prevent provider authentication environment variables (such as Key changes:
Confidence Score: 4/5
Last reviewed commit: 9c7ed9c |
|
Follow-up in 44e2192. Addressed the review points in the minimal patch:
Verification:
Local note: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44e219238c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@greptileai review now |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77ec72ec6b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@greptileai review now |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e89443791
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Follow-up in 9c7ed9c. Greptile was right about the unrelated Windows quoting regression in Fixed:
Verification:
|
|
@greptileai review now |
Strip shared provider auth env vars from ACP child process spawns on the default OpenClaw bridge and bundled acpx path, while preserving inherited auth for explicit custom servers and commands.
9c7ed9c to
0f67c17
Compare
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Brittle command string equality can disable provider auth env var stripping for the bundled acpx binary
Description
This makes the stripping policy easy to accidentally (or intentionally) bypass while still running the bundled binary, resulting in unexpected exposure of provider credentials to child processes. Vulnerable code: const command = resolveConfiguredCommand({ configured: normalized.command, workspaceDir: params.workspaceDir });
const stripProviderAuthEnvVars = command === ACPX_BUNDLED_BIN;RecommendationMake the decision based on the canonical resolved executable rather than raw string equality, and/or allow an explicit config override with a secure default. Option A (canonicalize paths): import fs from "node:fs";
function sameExecutable(a: string, b: string): boolean {
try {
return fs.realpathSync(a) === fs.realpathSync(b);
} catch {
return false;
}
}
const isBundled = sameExecutable(command, ACPX_BUNDLED_BIN);
const stripProviderAuthEnvVars = isBundled;Option B (explicit config): add Also consider normalizing case on Windows/macOS case-insensitive filesystems if relying on string comparison anywhere else. Analyzed PR: #42250 at commit Last updated on: 2026-03-10T21:59:29Z |
* main: (42 commits) test: share runtime group policy fallback cases refactor: share windows command shim resolution refactor: share approval gateway client setup refactor: share telegram payload send flow refactor: share passive account lifecycle helpers refactor: share channel config schema fragments refactor: share channel config security scaffolding refactor: share onboarding secret prompt flows refactor: share scoped account config patching feat(discord): add autoArchiveDuration config option (openclaw#35065) fix(gateway): harden token fallback/reconnect behavior and docs (openclaw#42507) fix(acp): strip provider auth env for child ACP processes (openclaw#42250) fix(browser): surface 429 rate limit errors with actionable hints (openclaw#40491) fix(acp): scope cancellation and event routing by runId (openclaw#41331) docs: require codex review in contributing guide (openclaw#42503) Fix stale runtime model reuse on session reset (openclaw#41173) docs: document r: spam auto-close label fix(ci): auto-close and lock r: spam items fix(acp): implicit streamToParent for mode=run without thread (openclaw#42404) test: extract sendpayload outbound contract suite ...
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]> (cherry picked from commit ff2e7a2)
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…2250) Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <[email protected]> Co-authored-by: Tak Hoffman <[email protected]> (cherry picked from commit ff2e7a2)
Summary
Describe the problem and fix in 2–5 bullets:
OPENAI_API_KEY,GITHUB_TOKEN, andHF_TOKENcan leak into ACP child processes.acpxspawn path now strip a shared list of provider auth env vars before spawning child ACP processes.acpxcommands still inherit their env-based auth contract.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
openclaw acpchild processes no longer inherit provider auth env vars from the parent OpenClaw process.acpxchild processes no longer inherit provider auth env vars from the parent OpenClaw process.acpxcommands continue to inherit provider auth env vars.secrets auditandsecrets applynow treat additional provider auth env vars such asGITHUB_TOKEN,GH_TOKEN,COPILOT_GITHUB_TOKEN, andANTHROPIC_OAUTH_TOKENas secrets, so plaintext.enventries for those keys are now flagged and scrubbed too.Security Impact (required)
Yes/No) NoYes/No) YesYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Provider auth env vars are now scrubbed before spawning default ACP child processes. This reduces unintended credential propagation. The main compatibility risk is breaking custom servers that rely on inherited creds, so the strip only applies to the default OpenClaw bridge path and bundled
acpxpath, not explicit custom commands. As part of unifying the secret list,secrets auditandsecrets applynow also treat additional provider tokens likeGITHUB_TOKENandGH_TOKENas secrets.Repro + Verification
Environment
acpx, explicit custom ACP server command, explicit customacpxcommandSteps
OPENAI_API_KEY,GITHUB_TOKEN, andHF_TOKENin the parent shell.acpxpath.acpxcommand.Expected
OPENCLAW_API_KEYremains available.acpxcommands still receive inherited provider auth env vars.Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
acpxstrips provider auth vars; explicit custom ACP servers preserve provider auth vars; explicit customacpxcommands preserve provider auth vars.OPENCLAW_API_KEYis preserved; non-_API_KEYauth vars likeGITHUB_TOKENandHF_TOKENare stripped where intended;src/plugin-sdk/subpaths.test.tsstill passes on the clean branch.Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
acpxcommand path.src/acp/client.ts,extensions/acpx/src/runtime-internals/process.ts,extensions/acpx/src/runtime.ts,src/secrets/provider-env-vars.tsacpxunexpectedly losing access to required provider creds; explicit custom commands unexpectedly losing inherited creds.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.src/secrets/provider-env-vars.tsand cover non-_API_KEYexamples in tests.acpxpath; explicit custom commands preserve inherited env vars.