Repository navigation
ci(notifications): escape commit messages in Telegram notifications - #980
Conversation
The notification step sends with parse_mode=HTML and escapes the branch, actor and PR title, but not the commit messages. Any commit with <, > or & (for example every "Co-authored-by: Name <email>" or "Signed-off-by" trailer) makes Telegram answer 400, so the step fails and no notification is sent. Escape the commit list the same way, and trim it so the message stays under Telegram's 4096-character limit.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe notification workflow now applies shared HTML escaping and a 3,900-character message limit to commit text after the push or pull-request branch builds its message. ChangesNotification message length limit
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Commit notifications now escape markup characters and trim long commit lists before delivery. No actionable delivery failure is established, so the change is minimally risky to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. I’m a rabbit with a message to send Comment |
… to ff6e596 Every Port queue line in the panel and side-repository ledgers now says `security: yes` or `security: no`. Security: c9b445a (passkey client rename), eb50bfd, PasarGuard#938, PasarGuard#940, PasarGuard#942, the cryptography 50.0.2 security release, and the ten commits of upstream's PasarGuard#979 permission-leak batch (user list scopes, API-key permissions, HWID visibility, users.read, the Telegram inline search), which no branch ports yet. Checked with git ls-remote on 2026-10-09: upstream dev moved to ff6e596. The PasarGuard#979 batch, the node RPC fixes (PasarGuard#977, PasarGuard#978), the core-deletion restart (PasarGuard#934), dashboard fixes (PasarGuard#852, PasarGuard#907, PasarGuard#949, PasarGuard#952), performance changes (PasarGuard#945, PasarGuard#853, PasarGuard#855) and the merged dependabot bumps (ruff, uvloop, fastapi) join the queue; the ruff and uvloop conditional waivers ended when upstream merged them. Waived: PasarGuard#980 and its branch commit (the Telegram notifier workflow the fork deleted) and the superseded fastapi dependabot head b021d6f. The refs snapshot records the five new heads. Fork core-kit main 90701408 now contains upstream d2ecb5bd, so that ledger is empty. No side repository gained an upstream commit since 2026-10-07.
Problem
The "Telegram Notification" workflow fails on most pushes to
dev(16 failures against 44 successes since 2026-09-20), so those notifications are never sent. Example: https://github.com/PasarGuard/panel/actions/runs/37852031693 ends withcurl: (22) The requested URL returned error: 400.The step sends with
parse_mode=HTMLand escapes the branch, actor and PR title, but not the commit messages. Any commit message with<,>or&breaks Telegram's HTML parsing. That includes everyCo-authored-by: Name <email>trailer that GitHub adds to squash merges, and theSigned-off-by: dependabot[bot] <[email protected]>trailer on Dependabot commits. The one recent push that succeeded (#907's squash commit) is the one without such a trailer.Change
After the push and PR branches build the commit list, it is:
html_escapehelper;....Testing
I ran the step's bash script locally with a fake
curland checked the text it would send against Telegram's HTML rules (only<b>/<a href>tags, valid entities, length limit). Four cases: a push with an email trailer and&/</>, a plain push, a push with 10 very long commit messages, and a PR event with aSigned-off-bytrailer.</>in the text); the plain push passes, which matches what happens on GitHub.8420c2c2now renders asCo-authored-by: etm <etm@LAPTOP-62O1BVSJ>, and the long case is trimmed to 3904 characters.chat^topic) are still sent.Summary by CodeRabbit