smengcl commented on code in PR #8984:
URL: https://github.com/apache/hadoop/pull/8984#discussion_r4560602170


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HostRestrictingAuthorizationFilter.java:
##########
@@ -350,23 +346,43 @@ public interface HttpInteraction {
   }
 
   private static class Rule {
-    private final SubnetUtils.SubnetInfo subnet;
+    private final String network;
+    private final Predicate<String> networkMatcher;
     private final String path;
 
     /*
      * A class for holding dropbox filter rules
      *
-     * @param subnet - the IPv4 subnet for which this rule is valid (pass
-     * null for any network location)
+     * @param network - the IPv4 or IPv6 network/bits for which this rule is
+     * valid (pass "*" for any network location)
      * @param path - the HDFS path for which this rule is valid
+     * @throws IllegalArgumentException - when the network can not be parsed
      */
-    Rule(SubnetUtils.SubnetInfo subnet, String path) {
-      this.subnet = subnet;
+    Rule(String network, String path) {
+      this.network = network;
       this.path = path;
+      if (network.trim().equals("*")) {
+        networkMatcher = remoteIp -> true;
+      } else if (network.indexOf(':') < 0) {

Review Comment:
   No change: with commons-net 3.9.0 (the version in `hadoop-project/pom.xml`), 
`new SubnetUtils("192.168.0.1")` throws `IllegalArgumentException: Could not 
parse [192.168.0.1]`, and `testRejectsInvalidNetwork` passes locally with that 
input, so it would also catch a future commons-net version that starts 
accepting a bare address.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to