From 05489d89c6ded7825cc7547e601390c2df78fb21 Mon Sep 17 00:00:00 2001
From: V02460 <V02460@gmail.com>
Date: Tue, 19 Mar 2024 18:19:12 +0100
Subject: [PATCH] Specify IP subnet literals in canonical form (#16953)

This is needed, because the netaddr package removed support for the
implicit prefix form in version 1.0.0:
https://github.com/netaddr/netaddr/pull/360
---
 changelog.d/16953.misc | 1 +
 tests/api/test_auth.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 changelog.d/16953.misc

diff --git a/changelog.d/16953.misc b/changelog.d/16953.misc
new file mode 100644
index 0000000000..81abcc3df0
--- /dev/null
+++ b/changelog.d/16953.misc
@@ -0,0 +1 @@
+Specify IP subnets in canonical form.
diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py
index ce85ddf22a..bd229cf7e9 100644
--- a/tests/api/test_auth.py
+++ b/tests/api/test_auth.py
@@ -128,7 +128,7 @@ class AuthTestCase(unittest.HomeserverTestCase):
             token="foobar",
             url="a_url",
             sender=self.test_user,
-            ip_range_whitelist=IPSet(["192.168/16"]),
+            ip_range_whitelist=IPSet(["192.168.0.0/16"]),
         )
         self.store.get_app_service_by_token = Mock(return_value=app_service)
         self.store.get_user_by_access_token = AsyncMock(return_value=None)
@@ -147,7 +147,7 @@ class AuthTestCase(unittest.HomeserverTestCase):
             token="foobar",
             url="a_url",
             sender=self.test_user,
-            ip_range_whitelist=IPSet(["192.168/16"]),
+            ip_range_whitelist=IPSet(["192.168.0.0/16"]),
         )
         self.store.get_app_service_by_token = Mock(return_value=app_service)
         self.store.get_user_by_access_token = AsyncMock(return_value=None)
-- 
GitLab