diff --git a/nemoclaw-blueprint/policies/openclaw-sandbox.yaml b/nemoclaw-blueprint/policies/openclaw-sandbox.yaml index 575d9be5c79..c7fe11ea73b 100644 --- a/nemoclaw-blueprint/policies/openclaw-sandbox.yaml +++ b/nemoclaw-blueprint/policies/openclaw-sandbox.yaml @@ -172,46 +172,10 @@ network_policies: binaries: - { path: /usr/local/bin/openclaw } - # ── Messaging — pre-allowed for OpenClaw agent notifications ──── - # Restricted to node processes to prevent arbitrary data exfiltration - # via curl, wget, python, etc. (See: #272) - telegram: - name: telegram - endpoints: - - host: api.telegram.org - port: 443 - protocol: rest - enforcement: enforce - rules: - - allow: { method: GET, path: "/bot*/**" } - - allow: { method: POST, path: "/bot*/**" } - - allow: { method: GET, path: "/file/bot*/**" } - binaries: - - { path: /usr/local/bin/node } - - discord: - name: discord - endpoints: - - host: discord.com - port: 443 - protocol: rest - enforcement: enforce - rules: - - allow: { method: GET, path: "/**" } - - allow: { method: POST, path: "/**" } - # WebSocket gateway — pure L4 CONNECT tunnel. OpenShell v0.0.15+ - # auto-terminates TLS unconditionally (NVIDIA/OpenShell#544), which - # also applies to WSS. tls: skip restores the pre-v0.0.15 pass- - # through behaviour needed here. Matches presets/discord.yaml. - - host: gateway.discord.gg - port: 443 - access: full - tls: skip - - host: cdn.discordapp.com - port: 443 - protocol: rest - enforcement: enforce - rules: - - allow: { method: GET, path: "/**" } - binaries: - - { path: /usr/local/bin/node } + # Messaging endpoints (telegram, discord, slack) are intentionally NOT in + # the baseline — #1705 removed them so every sandbox does not silently + # egress to third-party IM platforms without user opt-in. The messaging + # presets (presets/{telegram,discord,slack}.yaml) are the opt-in path: + # users enable a channel in step [5/8] of onboard and the matching preset + # is applied on top of this baseline. Keep this comment so the entries + # are not casually re-added during a merge-conflict resolution. See #2180. diff --git a/test/validate-blueprint.test.ts b/test/validate-blueprint.test.ts index 20c28bca909..7a4f4656d77 100644 --- a/test/validate-blueprint.test.ts +++ b/test/validate-blueprint.test.ts @@ -309,6 +309,59 @@ describe("base sandbox policy", () => { expect(serialized).not.toContain("/usr/local/bin/claude"); }); + it("regression #2180: base policy does not silently grant Telegram access", () => { + // Until #1705 (later regressed by #1700 and re-surfaced in #2180), + // `api.telegram.org` plus a /usr/local/bin/node binary lived in the + // base network_policies, so every sandbox could call the Telegram + // Bot API regardless of whether the user selected the telegram + // messaging channel or policy preset. The fix keeps Telegram access + // inside `presets/telegram.yaml`. This assertion blocks a regression + // where someone re-adds a telegram entry to the base policy and + // silently re-grants every sandbox unscoped Telegram access. + const np = policy.network_policies as Record | undefined; + expect(np && typeof np === "object" && "telegram" in np).toBe(false); + + const telegramHosts = findEndpoints((h) => h === "api.telegram.org"); + expect(telegramHosts).toEqual([]); + }); + + it("regression #2180: base policy does not silently grant Discord access", () => { + // Parallel to the Telegram regression above. Discord (discord.com, + // gateway.discord.gg, cdn.discordapp.com, media.discordapp.net) is + // the opt-in preset path, not baseline. Re-adding these endpoints + // to the base policy lets any sandbox reach Discord without the + // user having selected the discord messaging channel or preset. + const np = policy.network_policies as Record | undefined; + expect(np && typeof np === "object" && "discord" in np).toBe(false); + + const discordHosts = findEndpoints( + (h) => + h === "discord.com" || + h === "gateway.discord.gg" || + h === "cdn.discordapp.com" || + h === "media.discordapp.net", + ); + expect(discordHosts).toEqual([]); + }); + + it("regression #2180: base policy does not silently grant Slack access", () => { + // Slack was never in the baseline, but guard against it being added + // in the same merge-conflict-resolution pattern that re-added + // Telegram and Discord after #1705. Slack access is in + // presets/slack.yaml only. + const np = policy.network_policies as Record | undefined; + expect(np && typeof np === "object" && "slack" in np).toBe(false); + + const slackHosts = findEndpoints( + (h) => + h === "slack.com" || + h.endsWith(".slack.com") || + h === "wss-primary.slack.com" || + h === "wss-backup.slack.com", + ); + expect(slackHosts).toEqual([]); + }); + it("regression #1458: baseline npm_registry must not include npm or node binaries", () => { const np = policy.network_policies ?? {}; const npmRegistry = np.npm_registry;