Skip to content

fix(policy): add missing binaries to telegram policy entries - #388

Closed
imperator-clawdius wants to merge 2 commits into
NVIDIA:mainfrom
imperator-clawdius:fix/telegram-policy-binaries
Closed

imperator-clawdius wants to merge 2 commits into
NVIDIA:mainfrom
imperator-clawdius:fix/telegram-policy-binaries

Conversation

@imperator-clawdius

@imperator-clawdius imperator-clawdius commented Mar 19, 2026 •

Copy link
Copy Markdown

Problem

Issue 1: Missing binaries field (403 on CONNECT)

The telegram entries in openclaw-sandbox.yaml and presets/telegram.yaml lacked a binaries: field. The OPA engine treats absent binaries as deny-all, so the Node.js gateway (openclaw-gateway) was blocked from reaching api.telegram.org with 403 Forbidden on the CONNECT tunnel, despite the endpoint being listed in the policy.

A secondary issue: applying the telegram preset to a sandbox that already has the baseline telegram entry creates duplicate api.telegram.org:443 definitions across two policy keys (telegram + telegram_bot), triggering an OPA duplicated definition of local variable ep error that breaks L7 enforcement entirely.

Issue 2: Query strings stripped by L7 relay (403 no body)

tls: terminate + protocol: rest causes the L7 relay to strip query strings before forwarding requests to api.telegram.org. Telegram receives calls like getUpdates without parameters (e.g. ?timeout=30&offset=123) and returns 403 with no response body.

Fix

  • Switched telegram endpoint from tls: terminate + path rules to access: full (passthrough tunnel) — preserves query strings and avoids TLS MITM
  • Added binaries: [{path: /usr/local/bin/node}] to both entries so the Node.js gateway is permitted

Testing

Verified on a live NemoClaw sandbox — proxy logs confirm connections switched from CONNECT_L7 to plain CONNECT, and the Telegram bot API (getUpdates, getMe, getWebhookInfo, sendMessage) is fully operational.

Summary by CodeRabbit

  • Chores
    • Updated Telegram API endpoint policies to use full access configuration instead of granular method and path restrictions.
    • Added binary access restrictions, limiting Telegram API connectivity to Node.js runtime.

The telegram entries in openclaw-sandbox.yaml and the telegram preset
lacked a binaries field. The OPA engine treats absent binaries as
deny-all, so the Node.js gateway (openclaw-gateway) was blocked from
reaching api.telegram.org despite the policy listing the endpoint.

Also fixes a secondary OPA 'duplicated definition of local variable ep'
error that broke L7 enforcement when the preset's telegram_bot entry
was merged with the baseline telegram entry — both now declare
/usr/local/bin/node as the allowed binary.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@coderabbitai

coderabbitai Bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Network policy entries for Telegram (host api.telegram.org:443) were changed: REST-specific protocol, enforcement, TLS termination, and GET/POST path rules were removed and replaced with access: full, and a binaries entry was added referencing /usr/local/bin/node.

Changes

Cohort / File(s) Summary
Telegram network policy changes
nemoclaw-blueprint/policies/openclaw-sandbox.yaml, nemoclaw-blueprint/policies/presets/telegram.yaml
Replaced REST-specific protocol/enforcement/tls/rules for api.telegram.org:443 with access: full, and added a binaries entry including path: /usr/local/bin/node.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A rabbit hops where policies prance,
Rewrites rules and gives Node a chance.
Full access set, the pathways clear,
/usr/local/bin/node draws near.
Hooray—bots and bunnies cheer! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions adding binaries to telegram policy entries, which matches the primary fix of adding the binaries field. However, it omits the critical change from REST+TLS-terminate to full passthrough access that was necessary to fix query string stripping, making the title incomplete relative to the full scope of changes.
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
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.

Add a configuration file to your project to customize how CodeRabbit runs oxc.

@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)

168-169: Minor style inconsistency with other binaries entries in this file.

The change is functionally correct and resolves the OPA blocking issue. However, other binaries entries in this file use the inline YAML format (e.g., - { path: /usr/local/bin/claude }), while this uses the multi-line format. Consider aligning for consistency.

🔧 Optional: align with existing style
     binaries:
-      - path: /usr/local/bin/node
+      - { path: /usr/local/bin/node }
🤖 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 168 - 169,
The binaries entry uses multi-line YAML while other entries use the inline
style; change the list item for the "binaries" entry that currently contains
path: /usr/local/bin/node to the inline form (e.g., - { path:
/usr/local/bin/node }) so it matches the existing style conventions in this file
and keeps the "binaries" list consistent.
🤖 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 168-169: The binaries entry uses multi-line YAML while other
entries use the inline style; change the list item for the "binaries" entry that
currently contains path: /usr/local/bin/node to the inline form (e.g., - { path:
/usr/local/bin/node }) so it matches the existing style conventions in this file
and keeps the "binaries" list consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7107ee74-33db-4dad-a133-bb6c3239c453

📥 Commits

Reviewing files that changed from the base of the PR and between 3ba517d and bdef75b.

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

@imperator-clawdius

Copy link
Copy Markdown
Author

Sweet code, bro

tls: terminate + protocol: rest caused the L7 relay to strip query
strings before forwarding to api.telegram.org, resulting in 403
responses with no body from Telegram. Switching to access: full
passes the CONNECT tunnel through without TLS MITM or HTTP inspection,
so query parameters (e.g. timeout, offset) are forwarded intact.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

@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)

162-164: Add an inline note explaining why access: full is required.

Please add a short comment near this block capturing the query-string loss issue with tls: terminate + protocol: rest, so future hardening changes don’t reintroduce the regression.

🤖 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 162 - 164,
Add an inline YAML comment immediately above or beside the access: full line
explaining that full access is required to avoid a known regression where using
tls: terminate together with protocol: rest causes query-string parameters to be
dropped (loss of query-string) during request termination; reference the
condition (tls: terminate + protocol: rest) and mention the specific affected
binary/path (binaries: path: /usr/local/bin/node) so future hardening changes
know why access: full is necessary.
🤖 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 162-164: Add an inline YAML comment immediately above or beside
the access: full line explaining that full access is required to avoid a known
regression where using tls: terminate together with protocol: rest causes
query-string parameters to be dropped (loss of query-string) during request
termination; reference the condition (tls: terminate + protocol: rest) and
mention the specific affected binary/path (binaries: path: /usr/local/bin/node)
so future hardening changes know why access: full is necessary.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a6018c5a-0c02-4d86-a3a9-397807bc7226

📥 Commits

Reviewing files that changed from the base of the PR and between bdef75b and 7f675da.

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

@velezarturo268-lgtm

velezarturo268-lgtm commented Mar 19, 2026 via email

Copy link
Copy Markdown

@velezarturo268-lgtm

Copy link
Copy Markdown

I need help please I dont no watxto do

@wscurran wscurran added bug integration: telegram Telegram integration or channel behavior labels Mar 19, 2026
@velezarturo268-lgtm

Copy link
Copy Markdown

How do I get tokens and qat is this git hub about

@wscurran

Copy link
Copy Markdown
Contributor

Thanks for working on this. The same gap was closed by #645 (fix(security): add binaries restrictions to all messaging and preset policies), which added binaries restrictions across all messaging presets including Telegram. Closing as superseded by that fix.

1 similar comment
@wscurran

Copy link
Copy Markdown
Contributor

Thanks for working on this. The same gap was closed by #645 (fix(security): add binaries restrictions to all messaging and preset policies), which added binaries restrictions across all messaging presets including Telegram. Closing as superseded by that fix.

@wscurran wscurran closed this Apr 13, 2026
@wscurran wscurran added bug-fix PR fixes a bug or regression and removed bug labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression integration: telegram Telegram integration or channel behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants