Skip to content

Commit 5852c43

Browse files
committed
[enhancement] 0.0.0.0/0 IP Masks always match if they receive a valid IP as input
1 parent e2cee31 commit 5852c43

File tree

1 file changed

+4
-0
lines changed
  • src/main/java/org/elasticsearch/plugin/readonlyrest/acl/blocks/rules

1 file changed

+4
-0
lines changed

src/main/java/org/elasticsearch/plugin/readonlyrest/acl/blocks/rules/IPMask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ private static int addrToInt(Inet4Address i4addr) {
8686
*/
8787
public boolean matches(Inet4Address testAddr) {
8888
int testAddrInt = addrToInt(testAddr);
89+
// Always allow 0.0.0.0/0 as a wild card
90+
if (maskInt == -1 && addrInt == 0) {
91+
return true;
92+
}
8993
return (addrInt & maskInt) == (testAddrInt & maskInt);
9094
}
9195

0 commit comments

Comments
 (0)