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

fix: Add upper bound validation for MaxWithdrawalsPerPayload #2377

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

Description:
This PR adds an important security enhancement to the chain specification validation by implementing an upper bound check for MaxWithdrawalsPerPayload. This prevents potential DoS attacks and resource exhaustion that could occur if an extremely large number of withdrawals were allowed per payload.

Changes:

  • Added ErrExcessiveMaxWithdrawalsPerPayload error constant
  • Implemented upper bound validation (16384 withdrawals) in chainSpec.validate()
  • Improved code readability with better variable naming
  • Added comments explaining the rationale for the limits

Security Impact:
This change prevents potential DoS attacks by limiting the maximum number of withdrawals that can be processed in a single payload, while still maintaining reasonable operational capacity for the network.

Testing:
The existing test suite covers the validation logic, and the new limit is set to a practical value that shouldn't impact normal operation while preventing abuse.

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>
Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>
@VolodymyrBg VolodymyrBg requested a review from a team as a code owner January 19, 2025 19:39
Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>
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.

1 participant