Skip to content

fix(policy): allow Telegram file downloads in default sandbox policy#1302

Open
latenighthackathon wants to merge 3 commits intoNVIDIA:mainfrom
latenighthackathon:fix/telegram-file-download-policy
Open

fix(policy): allow Telegram file downloads in default sandbox policy#1302
latenighthackathon wants to merge 3 commits intoNVIDIA:mainfrom
latenighthackathon:fix/telegram-file-download-policy

Conversation

@latenighthackathon
Copy link
Copy Markdown
Contributor

@latenighthackathon latenighthackathon commented Apr 2, 2026

Summary

  • Add GET /file/bot*/** rule to the Telegram endpoint in the default sandbox policy

Related Issue

Closes #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

  • Conventional commit format
  • Scoped to issue, no unrelated changes
  • No secrets or credentials

Summary by CodeRabbit

  • Infrastructure Updates
    • Network policies updated to allow additional Telegram file download endpoints (adds GET access for file transfers), broadening supported Telegram API interactions.
    • Improves integration with Telegram bots by enabling retrieval of file resources while keeping existing bot API request permissions.

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.

Reported by @after-ephemera in NVIDIA Developer Discord.

Closes NVIDIA#1301
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e2f7dd50-0924-4cc6-9766-e0ddede737f1

📥 Commits

Reviewing files that changed from the base of the PR and between 2eb34ae and 353ddc1.

📒 Files selected for processing (1)
  • nemoclaw-blueprint/policies/presets/telegram.yaml
✅ Files skipped from review due to trivial changes (1)
  • nemoclaw-blueprint/policies/presets/telegram.yaml

📝 Walkthrough

Walkthrough

Added a network policy rule allowing GET requests to Telegram file download paths /file/bot*/** in the sandbox policy and preset, enabling Telegram file/audio downloads.

Changes

Cohort / File(s) Summary
Sandbox Policy
nemoclaw-blueprint/policies/openclaw-sandbox.yaml
Added allow: { method: GET, path: "/file/bot*/**" } to network_policies.telegram.endpoints[host: api.telegram.org].rules.
Preset Update
nemoclaw-blueprint/policies/presets/telegram.yaml
Added matching GET /file/bot*/** rule to the Telegram preset to align with the sandbox policy.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped a path of bytes and light,

Where files once hid just out of sight,
A tiny rule now clears the way,
Telegram files can come and stay —
Hooray! 📥

🚥 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 clearly describes the main change: adding a policy rule to allow Telegram file downloads in the default sandbox policy.
Linked Issues check ✅ Passed The pull request fully implements the coding requirements from issue #1301: adds the exact allow rule for GET /file/bot*/** to the Telegram endpoint in openclaw-sandbox.yaml, addressing the file download blocking issue.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue requirements; both modified files contain only the single policy rule addition for Telegram file downloads with no extraneous modifications.
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

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

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)

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 to GET is appropriate for read-only file retrieval.

Note: The preset policy at nemoclaw-blueprint/policies/presets/telegram.yaml only 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8f631ae and 2eb34ae.

📒 Files selected for processing (1)
  • nemoclaw-blueprint/policies/openclaw-sandbox.yaml

latenighthackathon and others added 2 commits April 1, 2026 23:41
Apply the same /file/bot*/** GET rule to the Telegram preset so users
who apply the preset also get file download support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(policy): Telegram file/audio downloads blocked — default policy missing /file/bot*/** path

1 participant