Skip to content

fix(safe): escape Markdown in protocol and additional_info#234

Merged
spalen0 merged 4 commits into
mainfrom
fix/safe-telegram-markdown-escape
May 23, 2026
Merged

fix(safe): escape Markdown in protocol and additional_info#234
spalen0 merged 4 commits into
mainfrom
fix/safe-telegram-markdown-escape

Conversation

@spalen0
Copy link
Copy Markdown
Collaborator

@spalen0 spalen0 commented May 23, 2026

Summary

  • Telegram's Markdown V1 was rejecting YEARN_MS multisig alerts with 400 Bad Request: can't parse entities because the _ in the protocol name opens an italic entity that never closes.
  • The fix wraps protocol and additional_info (both dev-controlled label strings from safe/addresses.py) through escape_markdown so any _ * \ [ \` chars are escaped.
  • Other interpolated fields (hex addresses, ints, ISO dates) stay raw since they can't contain Markdown specials.

Why this slipped through

YEARN_MS is the only protocol in ALL_SAFE_ADDRESSES whose name contains an underscore, so the bug only triggered once that safe had a pending tx. Every multisig run has been failing every 10 minutes since the first qualifying queued tx appeared (see failing run 26330640801).

Verification

Reproduced locally against Telegram's API:

  • Original (Protocol: YEARN_MS): 400 Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 64
  • After fix (Protocol: YEARN\_MS): 200 OK, renders as plain YEARN_MS text

Test plan

  • Merge and confirm next scheduled Monitor Safe Multisigs run succeeds
  • Confirm the YEARN_MS pending tx alert lands in the expected Telegram chat with YEARN_MS rendered as plain text

🤖 Generated with Claude Code

Telegram Markdown V1 was unable to parse messages for YEARN_MS because
the unescaped underscore opened an italic entity that never closed,
producing "Bad Request: can't parse entities". Routing all dev-controlled
label strings through escape_markdown prevents the same class of failure
for any future protocol or additional_info value containing _ * ` [ \.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@spalen0 spalen0 marked this pull request as ready for review May 23, 2026 12:29
spalen0 and others added 2 commits May 23, 2026 14:32
These entries were stored in checksum (mixed-case) form, but
check_for_pending_transactions lowercases tx["proposer"] before doing a
case-sensitive set lookup. The filter silently failed for those safes —
expected-proposer txs would now alert instead of being skipped.

The module docstring already specifies lowercase; this brings the new
entries in line with the convention and with the existing SAM/Curation
entries below.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@spalen0 spalen0 merged commit 30ecdaf into main May 23, 2026
2 checks passed
@spalen0 spalen0 deleted the fix/safe-telegram-markdown-escape branch May 23, 2026 18:19
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.

1 participant