diff --git a/apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift b/apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift index 408ed0476f11..747687866dc8 100644 --- a/apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift +++ b/apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift @@ -433,6 +433,11 @@ enum HostEnvSecurityPolicy { "REQUESTS_CA_BUNDLE", "RUSTC_WRAPPER", "RUSTFLAGS", + "RUSTUP_DIST_ROOT", + "RUSTUP_DIST_SERVER", + "RUSTUP_HOME", + "RUSTUP_TOOLCHAIN", + "RUSTUP_UPDATE_ROOT", "R_LIBS_USER", "SSH_ASKPASS", "SSH_AUTH_SOCK", diff --git a/src/infra/host-env-security-policy.json b/src/infra/host-env-security-policy.json index 0ebd41af553a..9454e69966f8 100644 --- a/src/infra/host-env-security-policy.json +++ b/src/infra/host-env-security-policy.json @@ -191,6 +191,11 @@ "PYTHONUSERBASE", "RUSTC_WRAPPER", "RUSTFLAGS", + "RUSTUP_DIST_ROOT", + "RUSTUP_DIST_SERVER", + "RUSTUP_HOME", + "RUSTUP_TOOLCHAIN", + "RUSTUP_UPDATE_ROOT", "CARGO_HOME", "VIRTUAL_ENV", "LUA_PATH", @@ -275,6 +280,11 @@ "NO_PROXY", "PAGER", "REQUESTS_CA_BUNDLE", + "RUSTUP_DIST_ROOT", + "RUSTUP_DIST_SERVER", + "RUSTUP_HOME", + "RUSTUP_TOOLCHAIN", + "RUSTUP_UPDATE_ROOT", "SSH_AUTH_SOCK", "SSL_CERT_DIR", "SSL_CERT_FILE", diff --git a/src/infra/host-env-security.reported-baseline.json b/src/infra/host-env-security.reported-baseline.json index 0b195fbd9067..fda9e6658f14 100644 --- a/src/infra/host-env-security.reported-baseline.json +++ b/src/infra/host-env-security.reported-baseline.json @@ -224,6 +224,11 @@ "REQUESTS_CA_BUNDLE", "RUSTC_WRAPPER", "RUSTFLAGS", + "RUSTUP_DIST_ROOT", + "RUSTUP_DIST_SERVER", + "RUSTUP_HOME", + "RUSTUP_TOOLCHAIN", + "RUSTUP_UPDATE_ROOT", "R_LIBS_USER", "SSH_ASKPASS", "SSH_AUTH_SOCK", @@ -252,5 +257,5 @@ "YARN_RC_FILENAME", "ZDOTDIR" ], - "expectedTotalReportedEntries": 247 + "expectedTotalReportedEntries": 252 } diff --git a/src/infra/host-env-security.reported-baseline.test.ts b/src/infra/host-env-security.reported-baseline.test.ts index 21f64ff57a75..decf8a1b4095 100644 --- a/src/infra/host-env-security.reported-baseline.test.ts +++ b/src/infra/host-env-security.reported-baseline.test.ts @@ -46,6 +46,11 @@ const INHERITED_ALLOWLIST_RATIONALE: Record = { NO_PROXY: "Trusted inherited proxy bypass list from operator runtime.", PAGER: "Trusted inherited default pager preference.", REQUESTS_CA_BUNDLE: "Trusted inherited Python requests CA bundle path.", + RUSTUP_DIST_ROOT: "Trusted inherited deprecated Rust static download mirror.", + RUSTUP_DIST_SERVER: "Trusted inherited Rust static download mirror.", + RUSTUP_HOME: "Trusted inherited Rust toolchain root selected by operator runtime.", + RUSTUP_TOOLCHAIN: "Trusted inherited Rust toolchain selector selected by operator.", + RUSTUP_UPDATE_ROOT: "Trusted inherited Rust self-update download mirror.", SSH_AUTH_SOCK: "Trusted inherited SSH agent socket from operator runtime.", SSL_CERT_DIR: "Trusted inherited OpenSSL certificate directory path.", SSL_CERT_FILE: "Trusted inherited OpenSSL certificate file path.", @@ -92,7 +97,7 @@ describe("host env reported baseline coverage", () => { baseline.reportedDangerousEverywhereKeys.length + baseline.reportedDangerousOverrideOnlyKeys.length, ).toBe(baseline.expectedTotalReportedEntries); - expect(baseline.expectedTotalReportedEntries).toBe(247); + expect(baseline.expectedTotalReportedEntries).toBe(252); expect(sortUniqueUpper(baseline.reportedDangerousEverywhereKeys)).toEqual( baseline.reportedDangerousEverywhereKeys, ); diff --git a/src/infra/host-env-security.test.ts b/src/infra/host-env-security.test.ts index e32bdab17f82..1c79de84da23 100644 --- a/src/infra/host-env-security.test.ts +++ b/src/infra/host-env-security.test.ts @@ -160,6 +160,10 @@ describe("isDangerousHostEnvVarName", () => { expect(isDangerousHostEnvVarName("CARGO_BUILD_RUSTC_WRAPPER")).toBe(true); expect(isDangerousHostEnvVarName("cargo_build_rustc_wrapper")).toBe(true); expect(isDangerousHostEnvVarName("cargo_home")).toBe(false); + expect(isDangerousHostEnvVarName("RUSTUP_DIST_SERVER")).toBe(false); + expect(isDangerousHostEnvVarName("RUSTUP_HOME")).toBe(false); + expect(isDangerousHostEnvVarName("rustup_update_root")).toBe(false); + expect(isDangerousHostEnvVarName("rustup_toolchain")).toBe(false); expect(isDangerousHostEnvVarName("CMAKE_C_COMPILER")).toBe(true); expect(isDangerousHostEnvVarName("cmake_c_compiler")).toBe(true); expect(isDangerousHostEnvVarName("CMAKE_CXX_COMPILER")).toBe(true); @@ -337,6 +341,11 @@ describe("sanitizeHostExecEnv", () => { AWS_CONFIG_FILE: "/tmp/aws-config", SSH_AUTH_SOCK: "/tmp/trusted-ssh-agent.sock", CARGO_HOME: "/tmp/cargo", + RUSTUP_DIST_ROOT: "https://mirror.example.test/deprecated-dist", + RUSTUP_DIST_SERVER: "https://mirror.example.test", + RUSTUP_HOME: "/tmp/rustup-home", + RUSTUP_TOOLCHAIN: "/tmp/rustup-toolchain", + RUSTUP_UPDATE_ROOT: "https://mirror.example.test/rustup", HELM_HOME: "/tmp/helm", HTTP_PROXY: "http://proxy.example.test:8080", HTTPS_PROXY: "http://proxy.example.test:8443", @@ -373,6 +382,11 @@ describe("sanitizeHostExecEnv", () => { SSL_CERT_DIR: "/tmp/evil-cert-dir", DOCKER_CONTEXT: "trusted-remote", DOCKER_HOST: "tcp://docker.example.test:2376", + RUSTUP_DIST_ROOT: "https://mirror.example.test/deprecated-dist", + RUSTUP_DIST_SERVER: "https://mirror.example.test", + RUSTUP_HOME: "/tmp/rustup-home", + RUSTUP_TOOLCHAIN: "/tmp/rustup-toolchain", + RUSTUP_UPDATE_ROOT: "https://mirror.example.test/rustup", OK: "1", }); }); @@ -902,6 +916,11 @@ describe("isDangerousHostEnvOverrideVarName", () => { expect(isDangerousHostEnvOverrideVarName("rustc_wrapper")).toBe(true); expect(isDangerousHostEnvOverrideVarName("RUSTFLAGS")).toBe(true); expect(isDangerousHostEnvOverrideVarName("rustflags")).toBe(true); + expect(isDangerousHostEnvOverrideVarName("RUSTUP_DIST_ROOT")).toBe(true); + expect(isDangerousHostEnvOverrideVarName("rustup_dist_server")).toBe(true); + expect(isDangerousHostEnvOverrideVarName("RUSTUP_HOME")).toBe(true); + expect(isDangerousHostEnvOverrideVarName("rustup_toolchain")).toBe(true); + expect(isDangerousHostEnvOverrideVarName("RUSTUP_UPDATE_ROOT")).toBe(true); expect(isDangerousHostEnvOverrideVarName("CARGO_BUILD_RUSTC_WRAPPER")).toBe(true); expect(isDangerousHostEnvOverrideVarName("cargo_build_rustc_wrapper")).toBe(true); expect(isDangerousHostEnvOverrideVarName("CARGO_HOME")).toBe(true); @@ -1042,6 +1061,11 @@ describe("sanitizeHostExecEnvWithDiagnostics", () => { PYTHONUSERBASE: "/tmp/evil-python-userbase", RUSTC_WRAPPER: "/tmp/evil-rustc-wrapper", RUSTFLAGS: "-C link-args=-l/tmp/evil.so", + RUSTUP_DIST_ROOT: "https://evil.example.test/deprecated-dist", + RUSTUP_DIST_SERVER: "https://evil.example.test", + RUSTUP_HOME: "/tmp/evil-rustup-home", + RUSTUP_TOOLCHAIN: "/tmp/evil-toolchain", + RUSTUP_UPDATE_ROOT: "https://evil.example.test/rustup", VIRTUAL_ENV: "/tmp/evil-venv", JAVA_OPTS: "-javaagent:/tmp/evil.jar", YARN_RC_FILENAME: ".evil-yarnrc.yml", @@ -1117,6 +1141,11 @@ describe("sanitizeHostExecEnvWithDiagnostics", () => { "REQUESTS_CA_BUNDLE", "RUSTC_WRAPPER", "RUSTFLAGS", + "RUSTUP_DIST_ROOT", + "RUSTUP_DIST_SERVER", + "RUSTUP_HOME", + "RUSTUP_TOOLCHAIN", + "RUSTUP_UPDATE_ROOT", "SSL_CERT_DIR", "SSL_CERT_FILE", "UV_DEFAULT_INDEX", @@ -1197,6 +1226,11 @@ describe("sanitizeHostExecEnvWithDiagnostics", () => { expect(result.env.PYTHONUSERBASE).toBeUndefined(); expect(result.env.RUSTC_WRAPPER).toBeUndefined(); expect(result.env.RUSTFLAGS).toBeUndefined(); + expect(result.env.RUSTUP_DIST_ROOT).toBeUndefined(); + expect(result.env.RUSTUP_DIST_SERVER).toBeUndefined(); + expect(result.env.RUSTUP_HOME).toBeUndefined(); + expect(result.env.RUSTUP_TOOLCHAIN).toBeUndefined(); + expect(result.env.RUSTUP_UPDATE_ROOT).toBeUndefined(); expect(result.env.VIRTUAL_ENV).toBeUndefined(); expect(result.env.YARN_RC_FILENAME).toBeUndefined(); });