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

Remove --host-whitelist 2.0 #7884

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
## Unreleased

### Breaking Changes
- `--host-whitelist` has been deprecated in favor of `--host-allowlist` since 2020 and will be removed in a future release

### Upcoming Breaking Changes
- Plugin API will be deprecating the BesuContext interface to be replaced with the ServiceManager interface.
- `MetricSystem::createLabelledGauge` is deprecated and will be removed in a future release, replace it with `MetricSystem::createLabelledSuppliedGauge`
- k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release
- `--host-whitelist` has been deprecated in favor of `--host-allowlist` since 2020 and will be removed in a future release
- Sunsetting features - for more context on the reasoning behind the deprecation of these features, including alternative options, read [this blog post](https://www.lfdecentralizedtrust.org/blog/sunsetting-tessera-and-simplifying-hyperledger-besu)
- Tessera privacy
- Smart-contract-based (onchain) permissioning
Expand Down
4 changes: 2 additions & 2 deletions benchmark/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ services:
- --rpc-ws-enabled
- --rpc-ws-apis=admin,eth,miner,web3,net,priv,eea
- --rpc-ws-host=0.0.0.0
- --host-whitelist=*
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of deleting this line, can you change to host-allowlist

Copy link
Author

Choose a reason for hiding this comment

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

Alright, I changed it to host-allowlist

- --host-allowlist=*
- --graphql-http-enabled
- --discovery-enabled=false
- --privacy-enabled=true
Expand All @@ -84,7 +84,7 @@ services:
- --rpc-ws-enabled
- --rpc-ws-apis=admin,eth,miner,web3,net,priv,eea
- --rpc-ws-host=0.0.0.0
- --host-whitelist=*
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of deleting this line, can you change to host-allowlist

Copy link
Author

@JanetMo JanetMo Nov 30, 2024

Choose a reason for hiding this comment

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

Changed as well, thanks for reviewing!

- --host-allowlist=*
- --graphql-http-enabled
- --discovery-enabled=false
- --privacy-enabled=true
Expand Down
8 changes: 0 additions & 8 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -610,14 +610,6 @@ static class PrivacyOptionGroup {
defaultValue = "localhost,127.0.0.1")
private final JsonRPCAllowlistHostsProperty hostsAllowlist = new JsonRPCAllowlistHostsProperty();

@Option(
names = {"--host-whitelist"},
hidden = true,
paramLabel = "<hostname>[,<hostname>...]... or * or all",
description =
"Deprecated in favor of --host-allowlist. Comma separated list of hostnames to allow for RPC access, or * to accept any host (default: ${DEFAULT-VALUE})")
private final JsonRPCAllowlistHostsProperty hostsWhitelist = new JsonRPCAllowlistHostsProperty();
Copy link
Contributor

Choose a reason for hiding this comment

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

There is also some code in the configure method of BesuCommand that uses the hostsWhitelist variable that needs to be removed as well

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review! You mean this part further down in the same file, of another one?

    // hostsWhitelist is a hidden option. If it is specified, add the list to hostAllowlist
    if (!hostsWhitelist.isEmpty()) {
      // if allowlist == default values, remove the default values
      if (hostsAllowlist.size() == 2
          && hostsAllowlist.containsAll(List.of("localhost", "127.0.0.1"))) {
        hostsAllowlist.removeAll(List.of("localhost", "127.0.0.1"));
      }
      hostsAllowlist.addAll(hostsWhitelist);
    }

Copy link
Contributor

Choose a reason for hiding this comment

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

@JanetMo if you run ./gradlew compileJava you will see compile errors locally

Copy link
Author

Choose a reason for hiding this comment

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

@macfarla Thanks, unfortunately we were still not able to run the repo locally... Could you guide us on which piece of code to remove?

Copy link
Contributor

Choose a reason for hiding this comment

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

@JanetMo feel free to post in discord if you're having trouble compiling or building locally, plenty of folks there that can help you out

Copy link
Author

Choose a reason for hiding this comment

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

@macfarla Thanks, appreciate the support. I retried but still wasn't able to build it locally, is there a way to unassign from the issue? I think I'm not up for it, and probably holding you back on with this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok yes I can unassign you @JanetMo - you're welcome back any time - but being able to compile the code is a must :)

Copy link
Author

Choose a reason for hiding this comment

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

@macfarla Thanks, I'm sorry it didn't work despite your help, learned something about Besu nevertheless 👍


@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"})
@Option(
names = {"--color-enabled"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@

public class HostAllowlistOptionsTest extends CommandTestAbstract {

/** test deprecated CLI option * */
@Deprecated
@Test
public void rpcHttpHostWhitelistAcceptsSingleArgument() {
parseCommand("--host-whitelist", "a");

verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();

assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist().size()).isEqualTo(1);
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist()).contains("a");
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist())
.doesNotContain("localhost");

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void rpcHttpHostAllowlistAcceptsSingleArgument() {
parseCommand("--host-allowlist", "a");
Expand Down Expand Up @@ -89,23 +71,6 @@ public void rpcHttpHostAllowlistAcceptsDoubleComma() {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Deprecated
@Test
public void rpcHttpHostWhitelistAllowlistAcceptsMultipleFlags() {
parseCommand("--host-whitelist=a", "--host-allowlist=b");

verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();

assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist().size()).isEqualTo(2);
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist()).contains("a", "b");
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist())
.doesNotContain("*", "localhost");

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void rpcHttpHostAllowlistAcceptsMultipleFlags() {
parseCommand("--host-allowlist=a", "--host-allowlist=b");
Expand Down