diff --git a/Dockerfile.base b/Dockerfile.base index d8736652581..4d90f594e83 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -58,6 +58,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ python3-venv=3.11.2-1+b1 \ curl=7.88.1-10+deb12u14 \ git=1:2.39.5-0+deb12u3 \ + gnupg=2.2.40-1.1+deb12u2 \ ca-certificates=20230311+deb12u1 \ iproute2=6.1.0-3 \ iptables=1.8.9-2 \ diff --git a/scripts/nemoclaw-start.sh b/scripts/nemoclaw-start.sh index 4d875917c0e..ea3e7687fec 100755 --- a/scripts/nemoclaw-start.sh +++ b/scripts/nemoclaw-start.sh @@ -84,12 +84,14 @@ done if [ "$(id -u)" -eq 0 ]; then install -d -o sandbox -g sandbox -m 755 \ /tmp/.npm-cache /tmp/.cache /tmp/.config /tmp/.local/share \ - /tmp/.local/state /tmp/.runtime /tmp/.gnupg /tmp/.claude \ + /tmp/.local/state /tmp/.runtime /tmp/.claude \ /tmp/npm-global + install -d -o sandbox -g sandbox -m 700 /tmp/.gnupg else mkdir -p /tmp/.npm-cache /tmp/.cache /tmp/.config /tmp/.local/share \ - /tmp/.local/state /tmp/.runtime /tmp/.gnupg /tmp/.claude \ + /tmp/.local/state /tmp/.runtime /tmp/.claude \ /tmp/npm-global + install -d -m 700 /tmp/.gnupg fi # ── Drop unnecessary Linux capabilities ────────────────────────── diff --git a/test/service-env.test.ts b/test/service-env.test.ts index d58c4d1eab5..8b19f875f23 100644 --- a/test/service-env.test.ts +++ b/test/service-env.test.ts @@ -189,9 +189,15 @@ describe("service environment", () => { expect(src).toContain("/tmp/.config"); expect(src).toContain("/tmp/.cache"); expect(src).toContain("/tmp/.local/share"); - expect(src).toContain("/tmp/.gnupg"); expect(src).toContain("/tmp/npm-global"); }); + + it("entrypoint creates GNUPGHOME with restrictive permissions", () => { + const scriptPath = join(import.meta.dirname, "../scripts/nemoclaw-start.sh"); + const src = readFileSync(scriptPath, "utf-8"); + expect(src).toContain("install -d -o sandbox -g sandbox -m 700 /tmp/.gnupg"); + expect(src).toContain("install -d -m 700 /tmp/.gnupg"); + }); }); describe("proxy environment variables (issue #626)", () => {