You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(telegram): stop auto-linking destinations in /policy show (#32)
* fix(telegram): stop auto-linking destinations in /policy show
Telegram was rendering every destination string in /policy show output
as a clickable blue link (example.com, api.github.com, etc.) because
the message was sent in plain text mode and Telegram auto-detects URL
patterns.
Wrap the output in <pre>...</pre> and send with ParseMode=HTML +
DisableWebPagePreview. Inside a preformatted block Telegram leaves URL
patterns alone, and the monospace rendering also aligns the columns
better.
- commands.go: htmlPreOpen/htmlPreClose constants, htmlEscapeText
helper, wrap both policyShow (engine fallback) and
policyShowFromStore in <pre>. Escape destination, tool, pattern,
replacement, name, source, default verdict, and protocols.
- approval.go: sendReply path sniffs the <pre> prefix and switches to
HTML parse mode with web-page preview disabled. Other replies are
still plain text.
- Tests: TestPolicyShowEscapesHTML and a wrapping check in
TestPolicyShowIncludesAllFields.
* fix(telegram): wrap destinations in <code> for approvals and mutations
Extends the /policy show fix to the other Telegram surfaces that
render destinations or URLs: approval prompts and policy mutation
confirmations (allow/deny). Without this, Telegram auto-links the
destination in strings like 'HTTPS api.github.com:443' or 'Added
allow rule: example.com' as a clickable blue URL.
- bot.go FormatApprovalMessage: wrap dest:port and the rendered
request URL in <code>. MCP tool name also in <code>.
- commands.go policyAllow / policyDeny: wrap dest in <code> on both
store and in-memory paths.
- Consolidate the duplicated htmlEscape helpers: commands.go now uses
the existing htmlEscape from bot.go, local wrapper removed.
- Update bot_test.go expectations to match the <code>-wrapped output.
0 commit comments