Repository navigation
a reader's bug report goes to Telegram instead of a Slack channel (cherry-pick of #2956) - #2960
Closed
Flotapponnier wants to merge 1 commit into
Closed
Flotapponnier wants to merge 1 commit into
Flotapponnier wants to merge 1 commit into
Conversation
) a reader's bug report goes to Telegram instead of a Slack channel /api/report posted to a Slack incoming webhook. A report is one person saying a number on the page looks wrong, which is the most useful message this site receives and the one most worth reading the same day. It now goes to a Telegram bot that DMs whoever owns the chat id. Telegram is tried first, Slack stays as the fallback it was, and with neither configured the route still answers 503 and the form still says reporting is not configured. So nothing breaks before the environment is set, and the Slack webhook can be retired whenever you like rather than in the same change. Both variables are required together. A token with no destination would look configured and send every report into a 502. Three details that are the whole reason this is not a two-line patch: HTML, not Markdown. Every value a reporter controls — the message, the contact, the User-Agent — already goes through slackSafe, which escapes &, < and >. That is exactly Telegram's HTML escape set, so the existing sanitising carries over unchanged. Markdown would need a different set and the two would drift apart the first time someone edited one. The response body is never logged. Telegram puts the bot token in the request URL rather than a header, and its error payload echoes the request, so the Slack path's habit of logging the body would have printed the token into the server log. Status code only. 4096 characters, Telegram's own ceiling, applied after assembly rather than to the message alone: the bench line, the page URL and the three context lines all count toward it. .env.example documents both variables and, more usefully, how to find a chat id at all: it is the destination, not the bot, and it only exists once someone has written to the bot.
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a reader's bug report goes to Telegram instead of a Slack channel
/api/report posted to a Slack incoming webhook. A report is one person
saying a number on the page looks wrong, which is the most useful message
this site receives and the one most worth reading the same day. It now goes
to a Telegram bot that DMs whoever owns the chat id.
Telegram is tried first, Slack stays as the fallback it was, and with
neither configured the route still answers 503 and the form still says
reporting is not configured. So nothing breaks before the environment is
set, and the Slack webhook can be retired whenever you like rather than in
the same change.
Both variables are required together. A token with no destination would look
configured and send every report into a 502.
Three details that are the whole reason this is not a two-line patch:
HTML, not Markdown. Every value a reporter controls — the message, the
contact, the User-Agent — already goes through slackSafe, which escapes &, <
and >. That is exactly Telegram's HTML escape set, so the existing
sanitising carries over unchanged. Markdown would need a different set and
the two would drift apart the first time someone edited one.
The response body is never logged. Telegram puts the bot token in the
request URL rather than a header, and its error payload echoes the request,
so the Slack path's habit of logging the body would have printed the token
into the server log. Status code only.
4096 characters, Telegram's own ceiling, applied after assembly rather than
to the message alone: the bench line, the page URL and the three context
lines all count toward it.
.env.example documents both variables and, more usefully, how to find a chat
id at all: it is the destination, not the bot, and it only exists once
someone has written to the bot.