mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 00:52:57 +00:00
fix: keep legacy agent dir env blocked
This commit is contained in:
@@ -72,6 +72,7 @@ on:
|
||||
- "src/agents/cli-runner/**"
|
||||
- "src/agents/command/**"
|
||||
- "src/agents/embedded-agent-runner/**"
|
||||
- "src/agents/sessions/tools/**"
|
||||
- "src/agents/tools/**"
|
||||
- "src/agents/*completion*.ts"
|
||||
- "src/agents/*transport*.ts"
|
||||
|
||||
@@ -382,7 +382,7 @@ describe("loadDotEnv", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("blocks path-override vars (OPENCLAW_AGENT_DIR, OPENCLAW_BUNDLED_PLUGINS_DIR, OPENCLAW_OAUTH_DIR) from workspace .env", async () => {
|
||||
it("blocks path-override vars from workspace .env", async () => {
|
||||
await withIsolatedEnvAndCwd(async () => {
|
||||
await withDotEnvFixture(async ({ base, cwdDir }) => {
|
||||
const bundledPluginsDir = path.join(base, "attacker-bundled");
|
||||
@@ -392,18 +392,21 @@ describe("loadDotEnv", () => {
|
||||
"OPENCLAW_AGENT_DIR=./evil-agent",
|
||||
`OPENCLAW_BUNDLED_PLUGINS_DIR=${bundledPluginsDir}`,
|
||||
"OPENCLAW_OAUTH_DIR=./evil-oauth",
|
||||
"PI_CODING_AGENT_DIR=./evil-pi-agent",
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
delete process.env.OPENCLAW_AGENT_DIR;
|
||||
delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
||||
delete process.env.OPENCLAW_OAUTH_DIR;
|
||||
delete process.env.PI_CODING_AGENT_DIR;
|
||||
|
||||
loadWorkspaceDotEnvFile(path.join(cwdDir, ".env"), { quiet: true });
|
||||
|
||||
expect(process.env.OPENCLAW_AGENT_DIR).toBeUndefined();
|
||||
expect(process.env.OPENCLAW_BUNDLED_PLUGINS_DIR).toBeUndefined();
|
||||
expect(process.env.OPENCLAW_OAUTH_DIR).toBeUndefined();
|
||||
expect(process.env.PI_CODING_AGENT_DIR).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -79,6 +79,7 @@ const BLOCKED_WORKSPACE_DOTENV_KEYS = new Set([
|
||||
"OPENCLAW_STATE_DIR",
|
||||
"OPENCLAW_TEST_TAILSCALE_BINARY",
|
||||
"PATH",
|
||||
"PI_CODING_AGENT_DIR",
|
||||
"PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH",
|
||||
"PROGRAMFILES",
|
||||
"PROGRAMFILES(X86)",
|
||||
|
||||
Reference in New Issue
Block a user