Skip to content

Commit 1187b53

Browse files
committed
Prevent rpc endpoints from being overridden
Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>
1 parent 05479e4 commit 1187b53

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,15 @@ private Map<String, JsonRpcMethod> jsonRpcMethods(
863863
dataDir,
864864
besuController.getProtocolManager().ethContext().getEthPeers());
865865
methods.putAll(besuController.getAdditionalJsonRpcMethods(jsonRpcApis));
866-
methods.putAll(rpcEndpointServiceImpl.getPluginMethods(jsonRpcConfiguration.getRpcApis()));
866+
867+
var pluginMethods = rpcEndpointServiceImpl.getPluginMethods(jsonRpcConfiguration.getRpcApis());
868+
869+
var overriddenMethods = methods.keySet().stream().filter(pluginMethods::containsKey).collect(Collectors.toList());
870+
if(overriddenMethods.size() > 0){
871+
throw new RuntimeException("You can not override built in methods " + overriddenMethods);
872+
}
873+
874+
methods.putAll(pluginMethods);
867875
return methods;
868876
}
869877

0 commit comments

Comments
 (0)