Fix MaxBytesReader limit breaking assignee requests and Decrypt panic on short input#17
Merged
Merged
Conversation
Security review findings from v0.3.0 to v0.4.0: 1. MaxBytesReader limit (1024 bytes) was too restrictive - broke the assignee feature (requests with assignee are ~1535 bytes) and was dangerously close to the limit for basic SIGN requests (~1005 bytes). Increased to 4096 bytes. 2. crypto.Decrypt panicked on short input (< 12 bytes) due to missing length validation before slice operations. Added proper bounds checking that returns nil on short/invalid input (consistent with existing error-handling pattern). Agent-Logs-Url: https://github.com/MixinNetwork/tip/sessions/11386e20-35e9-4396-ae29-bdcc1e2b30b3 Co-authored-by: cedricfung <2269238+cedricfung@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MixinNetwork/tip/sessions/11386e20-35e9-4396-ae29-bdcc1e2b30b3 Co-authored-by: cedricfung <2269238+cedricfung@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MixinNetwork/tip/sessions/11386e20-35e9-4396-ae29-bdcc1e2b30b3 Co-authored-by: cedricfung <2269238+cedricfung@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review changes for v0.3.0 to v0.4.0 regarding security and API issues
Fix MaxBytesReader limit breaking assignee requests and Decrypt panic on short input
Mar 30, 2026
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.
Security review of v0.3.0→v0.4.0 changes found two issues:
MaxBytesReader limit too small (API breaking change)
The 1024-byte
MaxBytesReaderlimit silently breaks the assignee feature. Measured request sizes:Basic SIGN barely fits; anything with an assignee is rejected outright. Increased to 4096.
crypto.Decryptpanics on short ciphertextb[:aead.NonceSize()]panics with index-out-of-range whenbis shorter than 12 bytes (GCM nonce). Reachable via API with a short base64-encodeddatafield. Added bounds check returningnil, consistent with existing error-handling pattern in the function.📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.