Skip to content

fix: add maximum size validation for JWT secrets to prevent DoS attacks#301

Open
crStiv wants to merge 2 commits intograndinetech:developfrom
crStiv:fix
Open

fix: add maximum size validation for JWT secrets to prevent DoS attacks#301
crStiv wants to merge 2 commits intograndinetech:developfrom
crStiv:fix

Conversation

@crStiv
Copy link
Copy Markdown

@crStiv crStiv commented Aug 15, 2025

Add maximum size validation for JWT secrets in eth1_api auth module

  • Add JWT_SECRET_SIZE_MAX_BYTES constant (1024 bytes) to prevent DoS attacks
  • Update size validation to check both minimum (32 bytes) and maximum (1024 bytes)
  • Improve error message to indicate valid size range
  • Add test case for large JWT secret rejection

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 15, 2025

CLA assistant check
All committers have signed the CLA.

@Tumas
Copy link
Copy Markdown
Member

Tumas commented Aug 18, 2025

Hey,

Thanks for the pull request! A few notes:

  • The secret is configured and read from the local filesystem, not exchanged over the network, so a DoS attack does not apply in this context.
  • According to the current spec, the secret key is expected to be 256 bits. If it is not, clients should return an error. Previously, the requirement was “at least 256 bits,” which explains the current implementation.

Feel free to adjust your pull request or open a new one to enforce an exact 256-bit check for the secret if you prefer.

@crStiv
Copy link
Copy Markdown
Author

crStiv commented Aug 23, 2025

@Tumas made some changes, hope I implemented everything exactly as you wished it to be done

@crStiv
Copy link
Copy Markdown
Author

crStiv commented Nov 12, 2025

@Tumas pinging

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