The vulnerability allows a workspace's .env file to override critical environment variables that define the location of bundled hooks, plugins, and skills (OPENCLAW_BUNDLED_HOOKS_DIR, OPENCLAW_BUNDLED_PLUGINS_DIR, OPENCLAW_BUNDLED_SKILLS_DIR). This could lead to the execution of untrusted code if a user opens a malicious project.
The patch in commit 330a9f98cb29c79b1c16a2117e03d6276a0d6289 rectifies this by introducing a blocklist, BLOCKED_WORKSPACE_DOTENV_KEYS, in src/infra/dotenv.ts. This list contains the sensitive environment variables that should not be configurable via a workspace .env file.
The functions loadWorkspaceDotEnvFile and loadCliDotEnv are the functions that read and apply the settings from .env files. Before the fix, these functions would process and load the malicious environment variables. The patch modifies their behavior to filter out the blocked keys. The associated test file, src/infra/dotenv.test.ts, was updated with tests that confirm loadWorkspaceDotEnvFile and loadCliDotEnv now correctly ignore these dangerous variables from workspace .env files, thus confirming these were the functions where the vulnerability existed.