Skip to content

feat: jwt authentication for RPC #302

Merged
vicentevieytes merged 17 commits into
mainfrom
jwt-auth
Aug 23, 2024
Merged

feat: jwt authentication for RPC #302
vicentevieytes merged 17 commits into
mainfrom
jwt-auth

Conversation

@vicentevieytes

@vicentevieytes vicentevieytes commented Aug 21, 2024

Copy link
Copy Markdown
Contributor

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

@vicentevieytes vicentevieytes changed the title feat: JWT authentication for RPC feat: jwt authentication for RPC Aug 23, 2024
Comment thread cmd/ethereum_rust/ethereum_rust.rs Outdated
Comment thread cmd/ethereum_rust/ethereum_rust.rs Outdated
Comment thread crates/rpc/rpc.rs Outdated

@ElFantasma ElFantasma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor details, but LGTM

@vicentevieytes vicentevieytes marked this pull request as ready for review August 23, 2024 20:29
@vicentevieytes vicentevieytes requested a review from a team as a code owner August 23, 2024 20:29
@vicentevieytes vicentevieytes added this pull request to the merge queue Aug 23, 2024
Merged via the queue into main with commit a6d2446 Aug 23, 2024
@vicentevieytes vicentevieytes deleted the jwt-auth branch August 23, 2024 20:44
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.

Add jwt authentication to engine api

2 participants