Skip to content

Commit

Permalink
Cancel validation for keys in black list in putKV command.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShannonDing committed Nov 27, 2023
1 parent 252d2d2 commit 216138e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,7 @@ public RemotingCommand putKVConfig(ChannelHandlerContext ctx,
response.setRemark("namespace or key is null");
return response;
}
if (validateBlackListConfigExist(requestHeader.getKey())) {
response.setCode(ResponseCode.NO_PERMISSION);
response.setRemark("Can not update config in black list.");
return response;
}

this.namesrvController.getKvConfigManager().putKVConfig(
requestHeader.getNamespace(),
requestHeader.getKey(),
Expand Down Expand Up @@ -686,7 +682,4 @@ private boolean validateBlackListConfigExist(Properties properties) {
return false;
}

private boolean validateBlackListConfigExist(String key) {
return configBlackList.contains(key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,6 @@ public void testProcessRequest_PutKVConfig() throws RemotingCommandException {

assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
.isEqualTo("value");

// use key in black list
RemotingCommand requestFailed = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
header);
requestFailed.addExtField("namespace", "namespace");
requestFailed.addExtField("key", "configBlackList");
requestFailed.addExtField("value", "value");

RemotingCommand responseFailed = defaultRequestProcessor.processRequest(null, requestFailed);

assertThat(responseFailed).isNotNull();
assertThat(responseFailed.getCode()).isEqualTo(ResponseCode.NO_PERMISSION);
assertThat(responseFailed.getRemark()).contains("Can not update config in black list.");
}

@Test
Expand Down

0 comments on commit 216138e

Please sign in to comment.