feat: jwt authentication for RPC #302
Merged
Merged
Conversation
This was referenced Aug 23, 2024
ElFantasma
reviewed
Aug 23, 2024
ElFantasma
reviewed
Aug 23, 2024
ElFantasma
reviewed
Aug 23, 2024
ElFantasma
approved these changes
Aug 23, 2024
ElFantasma
left a comment
Contributor
There was a problem hiding this comment.
Minor details, but LGTM
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.
Motivation
Json RPC calls to the engine execution API should be authenticated by bearing a JWT token as specified https://github.com/ethereum/execution-apis/blob/main/src/engine/authentication.md
This is to validate that authrpc calls are only issued by the consensus layer and prevents attack which would come from accidentally exposing the execution client to the internet.
Description
Introduces authentication.rs module which uses the jsonwebtoken crate to decode and validate tokens issued by the consensus layer.
The tokens contain a "iat" claim which stands for "issued at timestamp", according to the spec, this unix timestamp must be at most 60 seconds from the time of validation.
For this PR to pass the CI tests, this one needs to be merged first on lambdaclass/hive to enable the testing of the authentication by Hive:
https://github.com/lambdaclass/hive/pull/2/files
To enable authentication on our Kurtosis localnet this needs to be merged:
https://github.com/lambdaclass/ethereum-package/pull/2/files
Closes #13