Skip to content

fix(dotenv): reserve workspace OPENCLAW env namespace#69376

Merged
drobison00 merged 1 commit into
openclaw:mainfrom
eleqtrizit:fix/workspace-dotenv-prefix-guard
Apr 20, 2026
Merged

fix(dotenv): reserve workspace OPENCLAW env namespace#69376
drobison00 merged 1 commit into
openclaw:mainfrom
eleqtrizit:fix/workspace-dotenv-prefix-guard

Conversation

@eleqtrizit

Copy link
Copy Markdown
Contributor

Summary

  • reserve the OPENCLAW_* namespace for trusted shell and global runtime env input
  • fail closed for new workspace .env runtime-control keys instead of relying on per-key denylist updates

Changes

  • add an OPENCLAW_ workspace dotenv prefix guard in src/infra/dotenv.ts
  • extend the workspace dotenv regression test with representative runtime-control keys that were previously uncovered
  • add an unreleased changelog note for the workspace dotenv hardening

Validation

  • ran corepack pnpm test src/infra/dotenv.test.ts src/cli/update-cli.test.ts
  • ran timeout 120s claude -p "/review" and got a ship-it review with only optional cleanup suggestions
  • pre-commit format/lint passed; pnpm check:changed --staged hit unrelated existing infra failures in src/infra/restart-stale-pids.test.ts, src/infra/host-env-security.test.ts, src/infra/run-node.test.ts, src/infra/git-commit.test.ts, and src/infra/update-check.test.ts

Notes

  • trusted global runtime dotenv loading remains unchanged; this only narrows the untrusted workspace .env path
  • the broader explicit OPENCLAW_* entries in the denylist are now redundant, but I left that cleanup out to keep the fix minimal

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Apr 20, 2026
@greptile-apps

greptile-apps Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reserves the OPENCLAW_* environment namespace for trusted shell/global runtime configuration by adding "OPENCLAW_" to BLOCKED_WORKSPACE_DOTENV_PREFIXES in src/infra/dotenv.ts, and extends the workspace dotenv test suite with representative runtime-control keys that were previously unguarded. The approach correctly makes the workspace .env boundary fail-closed for all future OPENCLAW_* additions without per-key blocklist updates.

Confidence Score: 5/5

Safe to merge — the security fix is correct, well-tested, and intentionally minimal.

The core change (adding "OPENCLAW_" prefix to BLOCKED_WORKSPACE_DOTENV_PREFIXES) is straightforward and correct. The case-insensitivity path (.toUpperCase() before prefix check) already existed and is preserved. The new test cases cover the newly guarded keys and also confirm the trusted global path still passes them through. The redundant sub-prefix entries (OPENCLAW_CLAWHUB_, OPENCLAW_DISABLE_, OPENCLAW_SKIP_, OPENCLAW_UPDATE_) are acknowledged by the author as intentionally left for diff minimality. No P0 or P1 issues found.

No files require special attention.

Reviews (2): Last reviewed commit: "fix(dotenv): reserve workspace OPENCLAW ..." | Re-trigger Greptile

@eleqtrizit

Copy link
Copy Markdown
Contributor Author

@greptile review

@eleqtrizit

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@drobison00
drobison00 force-pushed the fix/workspace-dotenv-prefix-guard branch from 3bc7a68 to 3867c31 Compare April 20, 2026 18:37
@drobison00
drobison00 force-pushed the fix/workspace-dotenv-prefix-guard branch from 3867c31 to f4a634e Compare April 20, 2026 18:39
@drobison00
drobison00 merged commit 018494f into openclaw:main Apr 20, 2026
83 checks passed
loongfay pushed a commit to YuanbaoTeam/openclaw that referenced this pull request Apr 21, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants