Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement message size validation to prevent excessive payloads #1197

Merged
merged 7 commits into from
Jan 15, 2025

Conversation

abretonc7s
Copy link
Collaborator

@abretonc7s abretonc7s commented Jan 15, 2025

Description

Introduces a 1MB message size limit for communication streams to prevent potential memory issues and DoS attacks.

Changes

  • Added MAX_MESSAGE_LENGTH constant (1MB) in config
  • Implemented size validation in:
    • MobilePortStream
    • RemoteCommunicationPostMessageStream
  • Added comprehensive test coverage for size validation scenarios

Security Impact

Prevents potential denial of service attacks and memory issues from oversized messages in communication channels.

Added MAX_MESSAGE_LENGTH constant and implemented validation to ensure messages do not exceed the maximum allowed size in MobilePortStream and RemoteCommunicationPostMessageStream.
@abretonc7s abretonc7s changed the title Limitrpc feat: implement message size validation to prevent excessive payloads Jan 15, 2025
@abretonc7s abretonc7s marked this pull request as ready for review January 15, 2025 02:09
@abretonc7s abretonc7s requested a review from a team as a code owner January 15, 2025 02:09
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.06%. Comparing base (458c3fa) to head (eaeb971).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1197      +/-   ##
==========================================
+ Coverage   74.02%   74.06%   +0.04%     
==========================================
  Files         182      182              
  Lines        4343     4350       +7     
  Branches     1064     1066       +2     
==========================================
+ Hits         3215     3222       +7     
  Misses       1128     1128              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Copy link
Collaborator

@christopherferreira9 christopherferreira9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abretonc7s abretonc7s merged commit a24e803 into main Jan 15, 2025
36 checks passed
@abretonc7s abretonc7s deleted the limitrpc branch January 15, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants