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

Support basic auth in JSON RPC endpoint #6897

Merged
merged 3 commits into from Feb 17, 2023
Merged

Support basic auth in JSON RPC endpoint #6897

merged 3 commits into from Feb 17, 2023

Conversation

vbaranov
Copy link
Member

@vbaranov vbaranov commented Feb 15, 2023

Resolves #3501

Motivation

Blockscout doesn't support JSON RPC endpoints with basic auth.

Changelog

Support basic auth in JSON RPC endpoints by adding hackney params: [basic_auth: {"user", "pass"}].
ETHEREUM_JSONRPC_USER and ETHEREUM_JSONRPC_PASSWORD are for basic auth management.

Docs update in blockscout/docs#114.

Checklist for your Pull Request (PR)

end
[pool: :ethereum_jsonrpc]
|> (&if(System.get_env("ETHEREUM_JSONRPC_HTTP_INSECURE", "") == "true", do: [:insecure] ++ &1, else: &1)).()
|> (&if(basic_auth_user != "" && basic_auth_pass != "",
Copy link
Member

Choose a reason for hiding this comment

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

What if password is empty string?

Copy link
Member Author

Choose a reason for hiding this comment

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

Does it make sense to enable Basic auth on RPC endpoint with blank password? I think it is very unlikely case.

Copy link
Member

Choose a reason for hiding this comment

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

In some dev/test setups mb

Copy link
Member Author

Choose a reason for hiding this comment

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

It is valid. Implemented in 3b5dc3d.

@nikitosing nikitosing temporarily deployed to Tests February 16, 2023 12:30 — with GitHub Actions Inactive
@vbaranov vbaranov merged commit 65d7ad5 into master Feb 17, 2023
@vbaranov vbaranov deleted the vb-basic-auth branch February 17, 2023 07:19
fx0x55 pushed a commit to FunctionX/blockscout that referenced this pull request May 10, 2023
* Support basic auth in JSON RPC endpoint

* Review comment: Allow blank password in basi auth of JSON RPC endpoint

* Reuse basic auth configuration function

---------

Co-authored-by: sl1depengwyn <max.pengwyn@gmail.com>
(cherry picked from commit 65d7ad5)
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.

Authentication for JSON-RPC
3 participants