fix(policy): allow Telegram file downloads in default sandbox policy#1302
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughAdded a network policy rule to allow GET requests for Telegram file download paths ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
nemoclaw-blueprint/policies/openclaw-sandbox.yaml (1)
186-188: LGTM — rule correctly enables Telegram file downloads.The glob pattern
/file/bot*/**accurately matches Telegram's file download endpoint structure (/file/bot<token>/<file_path>), and restricting toGETis appropriate for read-only file retrieval.Note: The preset policy at
nemoclaw-blueprint/policies/presets/telegram.yamlonly defines rules for/bot*/**and does not include this/file/bot*/**rule. Consider updating the preset as well for consistency, so users who apply the Telegram preset also get file download support.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@nemoclaw-blueprint/policies/openclaw-sandbox.yaml` around lines 186 - 188, The preset policy for Telegram (telegram.yaml) is missing the file-download rule present in openclaw-sandbox.yaml; add an allow rule for GET with the path pattern /file/bot*/** to the telegram.yaml preset so the preset matches the sandbox behavior and enables Telegram file downloads for users applying the preset.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@nemoclaw-blueprint/policies/openclaw-sandbox.yaml`:
- Around line 186-188: The preset policy for Telegram (telegram.yaml) is missing
the file-download rule present in openclaw-sandbox.yaml; add an allow rule for
GET with the path pattern /file/bot*/** to the telegram.yaml preset so the
preset matches the sandbox behavior and enables Telegram file downloads for
users applying the preset.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3afeddfa-8752-408f-9071-2db30bcc3b7b
📒 Files selected for processing (1)
nemoclaw-blueprint/policies/openclaw-sandbox.yaml
prekshivyas
left a comment
There was a problem hiding this comment.
Clean and correct — thanks @latenighthackathon!
- Glob pattern validated with OPA glob.match ✓
- GET-only for file downloads (least privilege) ✓
- Applied consistently to both openclaw-sandbox.yaml and presets/telegram.yaml ✓
- Additive rule, no regression risk to existing /bot*/** rules ✓
Confirmed this is still needed post-#1081 since native OpenClaw channels inside the sandbox still make outbound requests to api.telegram.org through policy enforcement.
LGTM.
The Telegram Bot API serves file downloads at /file/bot<token>/<path> but the default policy only allows /bot*/**. Add GET /file/bot*/** so the sandbox can download incoming audio, voice, document, photo, and video attachments from users. Apply the same rule to the Telegram preset so users who apply the preset also get file download support. Reported by @after-ephemera in NVIDIA Developer Discord. Closes NVIDIA#1301 Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
6b8b431 to
3d5063a
Compare
…VIDIA#1302) ## Summary - Add `GET /file/bot*/**` rule to the Telegram endpoint in the default sandbox policy ## Related Issue Closes NVIDIA#1301 ## Changes The Telegram Bot API uses two path patterns: - **API calls**: `/bot<token>/getFile`, `/bot<token>/sendMessage` — covered by existing `/bot*/**` rules - **File downloads**: `/file/bot<token>/<file_path>` — **not covered** When a user sends an audio message, photo, document, or video to the bot, OpenClaw calls `getFile` (works) then downloads the file from `/file/bot<token>/<path>` (blocked with 403). Validated with OPA's `glob.match`: - `glob.match("/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")` → **false** (current — blocked) - `glob.match("/file/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")` → **true** (fix — allowed) ## Credit Reported by @after-ephemera in the NVIDIA Developer Discord community. ## Testing - OPA glob.match validation confirms the pattern matches file download paths - No impact on existing API call rules (`/bot*/**` unchanged) - Single line addition, no schema changes ## Checklist - [x] Conventional commit format - [x] Scoped to issue, no unrelated changes - [x] No secrets or credentials <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Infrastructure Updates** * Network policy updated to allow additional Telegram file-download endpoints (adds GET access for file transfers). * Improves Telegram bot integration by enabling retrieval of file resources while preserving existing bot API request permissions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
Add GET /file/bot*/** rule to both the telegram preset and openclaw-sandbox policy. This allows bots to download files via the Telegram Bot API file endpoint, which was previously blocked by the sandbox policy. Backport of upstream NVIDIA#1302.
…VIDIA#1302) ## Summary - Add `GET /file/bot*/**` rule to the Telegram endpoint in the default sandbox policy ## Related Issue Closes NVIDIA#1301 ## Changes The Telegram Bot API uses two path patterns: - **API calls**: `/bot<token>/getFile`, `/bot<token>/sendMessage` — covered by existing `/bot*/**` rules - **File downloads**: `/file/bot<token>/<file_path>` — **not covered** When a user sends an audio message, photo, document, or video to the bot, OpenClaw calls `getFile` (works) then downloads the file from `/file/bot<token>/<path>` (blocked with 403). Validated with OPA's `glob.match`: - `glob.match("/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")` → **false** (current — blocked) - `glob.match("/file/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")` → **true** (fix — allowed) ## Credit Reported by @after-ephemera in the NVIDIA Developer Discord community. ## Testing - OPA glob.match validation confirms the pattern matches file download paths - No impact on existing API call rules (`/bot*/**` unchanged) - Single line addition, no schema changes ## Checklist - [x] Conventional commit format - [x] Scoped to issue, no unrelated changes - [x] No secrets or credentials <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Infrastructure Updates** * Network policy updated to allow additional Telegram file-download endpoints (adds GET access for file transfers). * Improves Telegram bot integration by enabling retrieval of file resources while preserving existing bot API request permissions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
…VIDIA#1302) ## Summary - Add `GET /file/bot*/**` rule to the Telegram endpoint in the default sandbox policy ## Related Issue Closes NVIDIA#1301 ## Changes The Telegram Bot API uses two path patterns: - **API calls**: `/bot<token>/getFile`, `/bot<token>/sendMessage` — covered by existing `/bot*/**` rules - **File downloads**: `/file/bot<token>/<file_path>` — **not covered** When a user sends an audio message, photo, document, or video to the bot, OpenClaw calls `getFile` (works) then downloads the file from `/file/bot<token>/<path>` (blocked with 403). Validated with OPA's `glob.match`: - `glob.match("/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")` → **false** (current — blocked) - `glob.match("/file/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")` → **true** (fix — allowed) ## Credit Reported by @after-ephemera in the NVIDIA Developer Discord community. ## Testing - OPA glob.match validation confirms the pattern matches file download paths - No impact on existing API call rules (`/bot*/**` unchanged) - Single line addition, no schema changes ## Checklist - [x] Conventional commit format - [x] Scoped to issue, no unrelated changes - [x] No secrets or credentials <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Infrastructure Updates** * Network policy updated to allow additional Telegram file-download endpoints (adds GET access for file transfers). * Improves Telegram bot integration by enabling retrieval of file resources while preserving existing bot API request permissions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
Summary
GET /file/bot*/**rule to the Telegram endpoint in the default sandbox policyRelated Issue
Closes #1301
Changes
The Telegram Bot API uses two path patterns:
/bot<token>/getFile,/bot<token>/sendMessage— covered by existing/bot*/**rules/file/bot<token>/<file_path>— not coveredWhen a user sends an audio message, photo, document, or video to the bot, OpenClaw calls
getFile(works) then downloads the file from/file/bot<token>/<path>(blocked with 403).Validated with OPA's
glob.match:glob.match("/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")→ false (current — blocked)glob.match("/file/bot*/**", ["/"], "/file/bot123:ABC/voice/file.oga")→ true (fix — allowed)Credit
Reported by @after-ephemera in the NVIDIA Developer Discord community.
Testing
/bot*/**unchanged)Checklist
Summary by CodeRabbit
Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com