14 Commits
Author SHA1 Message Date
Nihaal Shaikh 06a5f9c8c9 Fix #2 - Reject IP addresses that Moodle cannot match
The custom IP field and the predefined ranges form accepted invalid
entries such as 2001:db8::1garbage, 192.168.1.0/24garbage or
192.168.1.0/999. address_in_subnet() silently skips those entries, so a
"must not" restriction with a typo let blocked users in.

Validation now only accepts formats address_in_subnet() can match: a
single address, a subnet (mask 0-32 / 0-128) or a range in the last
group with end >= start. IPv6 forms cleanremoteaddr() cannot parse are
rejected as well. JS and PHP share the same rules; PHP also checks each
entry against address_in_subnet() as a safety net.

- Allow spaces after commas in the restriction field
- Support IPv6 ranges, e.g. 2001:db8::1-ff
- Add PHPUnit tests for helper::is_valid_ipaddress_list()
- Bump version to 2026101500 (5.3.2)
2026-10-15 09:04:58 +02:00
Vincent Cornelis fe3a5b2302 Update #86c46bd0u - Add support for predefined IP addresses/ranges 2025-08-04 17:38:30 +02:00
Luuk Verhoeven 6633439651 Update RegExp to not exceed 132 characters 2024-07-20 22:12:54 +02:00
Juan Pablo de Castro (UVa) e44acd4a7f Support ipv4 ranges. 2022-02-01 08:41:47 +00:00
Luuk Verhoeven 29a4857d8a Update for MOODLE310 2020-11-18 09:45:40 +01:00
Luuk Verhoeven e7e711b67b #2 improve validating ipv6
ipv6 validation regex missing some escaping and strictness
2019-05-22 15:03:00 +02:00
Luuk Verhoeven 86dbd31b2e Add correct builds 2019-05-22 12:20:34 +02:00
Luuk Verhoeven 8eb790f800 #2 improve ip validation
Make sure validate ipv4 address is correct, dont allow additional junk.
2019-05-22 12:14:07 +02:00
Luuk Verhoeven dc0a3aeb43 Update code style 2019-05-15 14:14:14 +02:00
Luuk Verhoeven 30db56880f Add docblocks 2019-05-15 11:12:10 +02:00
Luuk Verhoeven ec6f3d71a4 Remove console.log using Y.log instead 2019-05-15 10:53:49 +02:00
Luuk Verhoeven f5561fc100 Update code style 2019-05-14 20:36:16 +02:00
Luuk Verhoeven 7a56d730d8 Update code style 2019-05-14 20:18:04 +02:00
Luuk Verhoeven ee0784d146 Init base structure 2019-05-14 19:55:34 +02:00