Repository navigation
fix(filters): reject invalid base64 deep-link payloads in CommandStart - #1963
Merged
JrooTJunior merged 2 commits intoOct 30, 2026
Merged
JrooTJunior merged 2 commits into
JrooTJunior merged 2 commits into
Conversation
Member
|
@claude, review it |
|
Claude finished @JrooTJunior's task in 15s —— View job Review of #1963Verdict: looks good to merge. I read the diff and the surrounding code. I did not run the test suite or linters in this job.
Nits: none blocking. |
✔️ Changelog found.Thank you for adding a description of the changes |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-3.x #1963 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 751 751
Lines 16802 16803 +1
=========================================
+ Hits 16802 16803 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Description
CommandStart(deep_link=True, deep_link_encoded=True)only catchesUnicodeDecodeErrorwhen it decodes the payload. If the payload is not valid base64url,urlsafe_b64decoderaisesbinascii.Errorinstead, and that error escapes the filter. This happens, for example, when the payload length is 4k+1:/start a,/start abcde, or a referral link that was cut short when copied.Because the filter raised, the observer stops at that handler and the update never reaches the handlers registered after it, such as a plain
CommandStart()fallback. The user gets no reply and the dispatcher logs "Cause exception while process update". Anyone can trigger this by typing/start a./start dGVzdA->referral(as expected)/start a->binascii.Error: Invalid base64-encoded string: number of data characters (1) cannot be 1 more than a multiple of 4, andplain_startis never calledThe fix also catches
binascii.Errorand turns it intoCommandException, the same way an undecodable UTF-8 payload is already handled. The filter now returnsFalseand propagation continues.Type of change
How Has This Been Tested?
/start aand/start abcdecases toTestCommandFilter.test_parse_command. Both fail withbinascii.Errorwithout the fix and pass with it.pytest tests: 2327 passed, 56 skipped (redis/mongo not configured)ruff format --checkandruff check --previewon the changed files, andmypy aiogramTest Configuration:
Checklist: