diff options
author | Josh <josh.t.richards@gmail.com> | 2024-10-31 16:59:27 -0400 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-11-06 08:19:56 +0000 |
commit | b059bc970bb25524a578233c4594feeec99e11a4 (patch) | |
tree | 3740b5be849cd3f0a38d5f2615f2c6022602294e /lib/private/Security | |
parent | 14013a5f18a9e005ee21cde913a7d18ef80aabdb (diff) | |
download | nextcloud-server-b059bc970bb25524a578233c4594feeec99e11a4.tar.gz nextcloud-server-b059bc970bb25524a578233c4594feeec99e11a4.zip |
fix(security): Handle IPv6 zone IDs used in link-local addresses
Signed-off-by: Josh <josh.t.richards@gmail.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r-- | lib/private/Security/Ip/Address.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/Security/Ip/Address.php b/lib/private/Security/Ip/Address.php index b4f12a7e295..217dae5feff 100644 --- a/lib/private/Security/Ip/Address.php +++ b/lib/private/Security/Ip/Address.php @@ -11,6 +11,7 @@ namespace OC\Security\Ip; use InvalidArgumentException; use IPLib\Address\AddressInterface; use IPLib\Factory; +use IPLib\ParseStringFlag; use OCP\Security\Ip\IAddress; use OCP\Security\Ip\IRange; @@ -21,7 +22,7 @@ class Address implements IAddress { private readonly AddressInterface $ip; public function __construct(string $ip) { - $ip = Factory::parseAddressString($ip); + $ip = Factory::parseAddressString($ip, ParseStringFlag::MAY_INCLUDE_ZONEID); if ($ip === null) { throw new InvalidArgumentException('Given IP address can’t be parsed'); } @@ -29,7 +30,7 @@ class Address implements IAddress { } public static function isValid(string $ip): bool { - return Factory::parseAddressString($ip) !== null; + return Factory::parseAddressString($ip, ParseStringFlag::MAY_INCLUDE_ZONEID) !== null; } public function matches(IRange... $ranges): bool { |