Github user rakeshadr commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/179#discussion_r101492640
  
    --- Diff: 
src/java/main/org/apache/zookeeper/server/command/FourLetterCommands.java ---
    @@ -153,13 +155,33 @@
          */
         public final static int telnetCloseCmd = 0xfff4fffd;
     
    -    final static HashMap<Integer, String> cmd2String =
    -        new HashMap<Integer, String>();
    +    private static final String ZOOKEEPER_4LW_COMMANDS_WHITELIST = 
"zookeeper.4lw.commands.whitelist";
    +
    +    final static Map<Integer, String> cmd2String = new HashMap<Integer, 
String>();
    +
    +    final static Set<String> whiteListedCommands = new HashSet<String>();
     
         public static Map<Integer, String> getCmdMapView() {
             return Collections.unmodifiableMap(cmd2String);
         }
     
    +    // ZOOKEEPER-2693: Only allow white listed commands.
    +    public static Set<String> getWhiteListedCmdView() {
    +        if (!whiteListedCommands.isEmpty()) {
    +            return Collections.unmodifiableSet(whiteListedCommands);
    +        }
    +
    +        String commands = 
System.getProperty(ZOOKEEPER_4LW_COMMANDS_WHITELIST);
    +        if (commands != null) {
    +            String[] list = commands.split(",");
    +            for (String cmd : list) {
    +                whiteListedCommands.add(cmd.trim());
    +            }
    +        }
    +
    +        return Collections.unmodifiableSet(whiteListedCommands);
    --- End diff --
    
    Please add an INFO log message about the acceptable and configured 
`4lwords`. The log message will be printed only once during startup or first 
cmd invocation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to