Skip to content

fix(policy): remove telegram + discord from base sandbox policy#2415

Merged
jyaunches merged 2 commits into
NVIDIA:mainfrom
latenighthackathon:fix/baseline-messaging-policy-leak
May 7, 2026
Merged

fix(policy): remove telegram + discord from base sandbox policy#2415
jyaunches merged 2 commits into
NVIDIA:mainfrom
latenighthackathon:fix/baseline-messaging-policy-leak

Conversation

@latenighthackathon

@latenighthackathon latenighthackathon commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

The base sandbox policy (nemoclaw-blueprint/policies/openclaw-sandbox.yaml) was silently granting every sandbox egress to api.telegram.org, discord.com, gateway.discord.gg, and cdn.discordapp.com — regardless of whether the user enabled the telegram/discord messaging channel in step [5/8] or ticked the preset in step [8/8] of onboard. This is a regression of a previously-fixed behavior.

After a fresh onboard that explicitly skipped messaging channels and did not tick Discord in the Balanced-tier preset picker, nemoclaw <name> policy-list reports:

● discord — Discord API, gateway, and CDN access (active on gateway, missing from local state)

Problem

Regression history:

Once discord exists as a key in the gateway's loaded policy, policies.getGatewayPresets() detects the Discord preset as active (it matches on key presence). nemoclaw policy-list then renders the misleading "active on gateway, missing from local state" line for a preset the user never selected — and the egress is actually enforced, so it's a real capability grant, not just a display bug.

Test plan

  • npx vitest run test/validate-blueprint.test.ts test/policies.test.ts — 124 tests pass, including the three new regression tests that guard against this specific re-add pattern for telegram, discord, and slack.
  • npx vitest run test/validate-configs-dangerous-hosts.test.ts test/onboard.test.ts — 160 tests pass. No onboard-flow regressions.
  • Manually verified that users who enable a messaging channel in step [5/8] and apply the corresponding preset in step [8/8] still get identical endpoint access via presets/{telegram,discord}.yaml (no preset YAML changes in this PR).
  • openclaw-sandbox-permissive.yaml (used for --dangerously-skip-permissions) unchanged — permissive users still get pre-allowed messaging as before.

Fixes #2180.

Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com

Summary by CodeRabbit

  • Bug Fixes

    • Removed default network permissions for Telegram and Discord from the sandbox baseline; messaging endpoints (Telegram, Discord, Slack) are no longer enabled by default and must be added via opt-in presets during onboarding.
  • Tests

    • Added regression tests to ensure messaging provider access (Telegram, Discord, Slack) remains restricted in the baseline policy and cannot be reintroduced inadvertently.

@copy-pr-bot

copy-pr-bot Bot commented Apr 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Removed Telegram and Discord network policy entries from the OpenClaw sandbox baseline and added regression tests ensuring messaging providers (Telegram, Discord, Slack) are not present in the base network policy; baseline now documents that messaging endpoints are opt-in via presets.

Changes

Baseline network policy & tests

Layer / File(s) Summary
Policy comment / intent
nemoclaw-blueprint/policies/openclaw-sandbox.yaml
Replaced previous Telegram/Discord blocks with a comment explaining messaging endpoints (telegram/discord/slack) are excluded from the baseline and must be added via opt-in presets.
Policy removal
nemoclaw-blueprint/policies/openclaw-sandbox.yaml
Removed top-level telegram and discord network policy entries (endpoints and node binaries restrictions) from the OpenClaw sandbox baseline.
Regression tests
test/validate-blueprint.test.ts
Added three Vitest regression cases under base sandbox policy that assert absence of top-level telegram, discord, and slack keys and verify no base-policy endpoints match provider hostnames (including Slack websocket variants).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped the YAML fence at night,
Nibbled out endpoints out of sight.
Opt-in bells now keep the door,
Tests stand guard across the floor.
A tiny hop — policies made right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: removing Telegram and Discord from the base sandbox policy, which directly addresses the regression described in the linked issue.
Linked Issues check ✅ Passed The PR fully addresses the objective in issue #2180 by removing messaging endpoints (Telegram and Discord) from the base policy and adding regression tests to prevent re-introduction, restoring the opt-in behavior for messaging presets.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the messaging policy regression: removal of Telegram/Discord from base policy, addition of explanatory comments, and three regression tests covering Telegram, Discord, and Slack prevention.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@latenighthackathon latenighthackathon changed the title fix(policy): remove telegram + discord from base sandbox policy (fixes #2180) fix(policy): remove telegram + discord from base sandbox policy Apr 24, 2026
@wscurran wscurran added bug Something fails against expected or documented behavior security Potential vulnerability, unsafe behavior, or access risk priority: high integration: telegram Telegram integration or channel behavior integration: discord Discord integration or channel behavior labels Apr 27, 2026
@wscurran

Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this pull request that proposes a way to fix a bug that causes the base sandbox policy to silently grant egress to Telegram and Discord. This identifies a bug and proposes a change to remove these messaging channels from the baseline policy, addressing a previously-fixed behavior that was reintroduced.


Related open PRs:

@latenighthackathon latenighthackathon force-pushed the fix/baseline-messaging-policy-leak branch 2 times, most recently from 6f1fe0f to c47fdd3 Compare May 5, 2026 02:11
@jyaunches jyaunches self-assigned this May 6, 2026
…NVIDIA#2180)

After a fresh `nemoclaw onboard` with Balanced tier defaults, where the
user explicitly skipped messaging channels in step [5/8] and did not
tick Discord in step [8/8], `nemoclaw <name> policy-list` reports:

    ● discord — Discord API, gateway, and CDN access
      (active on gateway, missing from local state)

The sandbox can reach `discord.com`, `gateway.discord.gg`, and
`cdn.discordapp.com` without the user having opted in — the base
sandbox policy's own header says "deny by default, allow only what's
needed for core functionality," which messaging to third-party IM
platforms is not. Same story for `api.telegram.org`.

This is a regression, not a new bug:

- NVIDIA#1705 (2026-04-09, 77051cc) removed pre-allowed `telegram` and
  `discord` from `nemoclaw-blueprint/policies/openclaw-sandbox.yaml`
  for exactly this reason.
- NVIDIA#1700 (2026-04-14, 855924f), an unrelated npm_registry PR, was
  rebased on a branch that predated NVIDIA#1705 and re-added both entries
  during conflict resolution. The CodeRabbit release notes on NVIDIA#1700
  even called this out as "Added network policy entries to enable
  controlled Telegram and Discord messaging access" — it landed along
  with the legitimate npm_registry tightening and has been in the
  baseline since.

Once a key like `discord` exists in the gateway's loaded policy,
`policies.getGatewayPresets()` detects the Discord preset as active
(it matches on key presence), and `policy-list` then renders the
misleading "active on gateway, missing from local state" line.

- Re-remove `telegram` and `discord` entries from
  `nemoclaw-blueprint/policies/openclaw-sandbox.yaml`. Messaging
  endpoints are only reachable if the user selects the matching
  channel in step [5/8] and the corresponding preset is applied on
  top of the baseline in step [8/8]. Leave a comment block at the
  removed location referencing NVIDIA#1705, NVIDIA#2180, and the preset path so
  the next merge-conflict resolution does not casually re-add them.
- Add three regression tests in `test/validate-blueprint.test.ts`
  mirroring the existing `NVIDIA#1583` GitHub pattern:
  - `regression NVIDIA#2180: base policy does not silently grant Telegram access`
  - `regression NVIDIA#2180: base policy does not silently grant Discord access`
  - `regression NVIDIA#2180: base policy does not silently grant Slack access`
    (guard against the same merge pattern re-adding Slack even though
    it was never in the baseline historically)
  Each asserts both the key absence in `network_policies` and the
  absence of any host-matching endpoint anywhere in the base policy,
  so a rename can't smuggle the grant back in.

- `npx vitest run test/validate-blueprint.test.ts test/policies.test.ts`
  — 124 tests pass including the 3 new regressions.
- `npx vitest run test/validate-configs-dangerous-hosts.test.ts test/onboard.test.ts`
  — 160 tests pass, no onboard flow regressions.

Touches only the base policy YAML and the blueprint validator. Does
not modify any preset (presets/telegram.yaml, presets/discord.yaml,
presets/slack.yaml) — users who enabled messaging via onboard still
get the same preset applied on top of baseline and retain the same
endpoint access. The permissive variant
(openclaw-sandbox-permissive.yaml), used for
`--dangerously-skip-permissions`, is intentionally unchanged.

Fixes NVIDIA#2180.

Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@jyaunches jyaunches force-pushed the fix/baseline-messaging-policy-leak branch from c47fdd3 to 054392c Compare May 6, 2026 12:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
nemoclaw-blueprint/policies/openclaw-sandbox.yaml (1)

175-181: Run targeted network policy E2E for this change class.

Given this is a baseline egress policy edit, run the network-policy-e2e job on the PR branch to re-validate deny-by-default, whitelist behavior, hot-reload, and SSRF protections before merge. As per coding guidelines, "E2E test recommendation: network-policy-e2e — deny-by-default, whitelist, hot-reload, SSRF".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemoclaw-blueprint/policies/openclaw-sandbox.yaml` around lines 175 - 181,
This PR touches the baseline egress policy (the openclaw-sandbox.yaml baseline
comment block) so run the network-policy-e2e job on the PR branch to validate
deny-by-default, whitelist behavior, hot-reload, and SSRF protections; trigger
the network-policy-e2e pipeline (job name: network-policy-e2e) against this
branch and attach the results to the PR, ensuring the e2e passes before merging
to confirm the baseline egress change is safe.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@nemoclaw-blueprint/policies/openclaw-sandbox.yaml`:
- Around line 175-181: This PR touches the baseline egress policy (the
openclaw-sandbox.yaml baseline comment block) so run the network-policy-e2e job
on the PR branch to validate deny-by-default, whitelist behavior, hot-reload,
and SSRF protections; trigger the network-policy-e2e pipeline (job name:
network-policy-e2e) against this branch and attach the results to the PR,
ensuring the e2e passes before merging to confirm the baseline egress change is
safe.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 78e3572c-5e3f-4a3a-88ba-1555155cc2cd

📥 Commits

Reviewing files that changed from the base of the PR and between c47fdd3 and 054392c.

📒 Files selected for processing (2)
  • nemoclaw-blueprint/policies/openclaw-sandbox.yaml
  • test/validate-blueprint.test.ts

@jyaunches jyaunches added this to the v0.0.37 milestone May 7, 2026
@jyaunches jyaunches merged commit 34e0cba into NVIDIA:main May 7, 2026
10 checks passed
jyaunches pushed a commit that referenced this pull request May 8, 2026
## Summary
- Bump the docs release metadata to `0.0.37`.
- Document release-prep updates for messaging policy presets, sandbox
runtime utilities, and the GPU CDI troubleshooting path.
- Refresh generated `nemoclaw-user-*` skills from the updated docs.

## Source summary
- #3159 -> `docs/reference/troubleshooting.md`: Documents the GPU CDI
preflight warning and remediation for `nvidia.com/gpu=all` gateway start
failures.
- #2415 -> `docs/reference/network-policies.md`,
`docs/manage-sandboxes/messaging-channels.md`,
`docs/network-policy/customize-network-policy.md`: Clarifies that
Telegram, Discord, and Slack egress comes from opt-in messaging presets,
not the baseline policy.
- #3091 -> `docs/deployment/sandbox-hardening.md`,
`docs/network-policy/customize-network-policy.md`: Documents the
retained sandbox utilities `vi`, `jq`, and `dos2unix` while keeping
host-side policy files as the durable source of truth.

## Test plan
- `python3 scripts/docs-to-skills.py docs/ .agents/skills/ --prefix
nemoclaw-user`
- `make docs`
- `npm run build:cli`
- `npm run typecheck:cli`
- Commit and pre-push hooks: markdownlint, docs-to-skills verification,
gitleaks, commitlint, CLI typecheck

## Skipped
- #3193 and #3191 matched `docs/.docs-skip` entries for experimental
shields/config paths.
- #3200 and #3183 were test-only fixes.
- #3189 and #3163 were internal documentation/refactor changes with no
public docs impact.

Made with [Cursor](https://cursor.com)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Clarified which utilities remain in the sandbox runtime for
lightweight inspection and cleanup
* Noted that messaging endpoints (Discord, Slack, Telegram) are not in
the baseline policy and that channel presets are applied during
onboarding
  * Added GPU passthrough troubleshooting for gateway startup
* Updated release/version bump and release-prep workflow guidance,
including Discord preset description updates
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@latenighthackathon latenighthackathon deleted the fix/baseline-messaging-policy-leak branch May 18, 2026 05:10
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: policy Network policy, egress rules, presets, or sandbox policy bug-fix PR fixes a bug or regression labels Jun 3, 2026
@wscurran wscurran added feature PR adds or expands user-visible functionality needs: review PR is conflict-free and awaiting maintainer review and removed priority: high bug Something fails against expected or documented behavior needs: review PR is conflict-free and awaiting maintainer review feature PR adds or expands user-visible functionality labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: policy Network policy, egress rules, presets, or sandbox policy bug-fix PR fixes a bug or regression integration: discord Discord integration or channel behavior integration: telegram Telegram integration or channel behavior security Potential vulnerability, unsafe behavior, or access risk

Projects

None yet

3 participants