We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e549bec commit 9bfafe9Copy full SHA for 9bfafe9
1 file changed
python/philologic/runtime/access_control.py
@@ -11,6 +11,7 @@
11
import netaddr
12
import regex as re
13
from netaddr import IPSet
14
+
15
from philologic.runtime.DB import DB
16
from philologic.utils import load_module
17
@@ -98,6 +99,9 @@ def load_or_compile_ip_whitelist(access_file):
98
99
# Exact IP address
100
exact_ips.add(ip)
101
102
+ # Match prefixes of exact IPs as well (e.g., "192.168.1.12" should match "192.168.1.123")
103
+ regex_patterns.add(re.compile(f"^{re.escape(ip)}.*$"))
104
105
except (ValueError, netaddr.AddrFormatError) as e:
106
# Fallback to regex for any formats netaddr can't handle
107
print(f"Warning: Could not parse IP '{ip}': {str(e)}", file=sys.stderr)
0 commit comments