fix(telegram): redact bot tokens from poller errors - #4823
fix(telegram): redact bot tokens from poller errors#4823gotnochill815-web wants to merge 1 commit into
Conversation
Greptile code reviewThis repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md. Run a review — add a PR comment with: Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5. Optional: automate with the greploop skill. |
Greptile SummaryThe PR redacts Telegram bot tokens from poller exceptions, Telegram HTTP error descriptions, and client transport errors while retaining exception-type diagnostics.
Confidence Score: 4/5The PR appears safe to merge, with only a non-blocking HTTP-status constant convention issue in a new test. The changed runtime paths redact the configured token before logging or returning the targeted errors, and the only accepted concern is the use of a numeric HTTP status in regression coverage. Files Needing Attention: gateway/tests/telegram/test_telegram_poller.py
|
| Filename | Overview |
|---|---|
| gateway/transports/telegram/poller/client.py | Redacts the configured bot token from transport exception strings before they are logged or returned. |
| gateway/transports/telegram/poller/poller.py | Redacts tokens from transient exceptions and failed poll-response descriptions while logging the exception type separately. |
| gateway/tests/telegram/test_telegram_client.py | Adds focused coverage confirming client transport errors no longer expose the token. |
| gateway/tests/telegram/test_telegram_poller.py | Adds effective exception and HTTP-response redaction tests, but the new HTTP response fixture uses a hardcoded status code contrary to repository conventions. |
Reviews (1): Last reviewed commit: "fix(telegram): redact bot tokens from po..." | Re-trigger Greptile
|
|
||
| token = "123456:SECRET" | ||
|
|
||
| mock_get.return_value = httpx.Response( |
There was a problem hiding this comment.
The new response fixture uses the numeric status 500 instead of the repository-required named HTTPStatus constant, making the test less self-documenting and inconsistent with the established HTTP-status convention.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Hey @gotnochill815-web someone else is already assigned to this issue. You have to take something else. |
Fixes #4769.
Summary
Prevent Telegram bot tokens from appearing in gateway logs or caller-visible errors when transient HTTP failures occur.
Changes
getUpdatesexceptions before logging.TelegramBotClienttransport errors.Testing
pytest -q gateway/tests/telegram/test_telegram_poller.py gateway/tests/telegram/test_telegram_client.py- 10 passedruff checkon changed files - passedgit diff --check- passed