From f9546412afd5c5e5734928638fc0ffde5b457182 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 24 Sep 2026 23:20:31 +0900 Subject: [PATCH] Add test case to check empty signature header Related-Bug: #2164987 Change-Id: Ie0d982b78612a149a602b29b9573cc50a4ed3668 Signed-off-by: Takashi Kajinami --- .../unit/transport/wsgi/v2_0/test_urls.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/zaqar/tests/unit/transport/wsgi/v2_0/test_urls.py b/zaqar/tests/unit/transport/wsgi/v2_0/test_urls.py index 3b91146f2..abb19d14e 100644 --- a/zaqar/tests/unit/transport/wsgi/v2_0/test_urls.py +++ b/zaqar/tests/unit/transport/wsgi/v2_0/test_urls.py @@ -110,6 +110,36 @@ class TestURL(base.V2Base): response = self.simulate_get(content['paths'][0], headers=headers) self.assertEqual(falcon.HTTP_200, self.srmock.status) + def test_url_verification_fail_bad_signature(self): + data = {'methods': ['GET', 'POST']} + response = self.simulate_post(self.signed_url_prefix, + body=jsonutils.dumps(data)) + + self.assertEqual(falcon.HTTP_200, self.srmock.status) + content = jsonutils.loads(response[0]) + + headers = { + 'URL-Signature': content['signature'][:-1], + 'URL-Expires': content['expires'], + 'URL-Methods': ','.join(content['methods']), + 'URL-Paths': ','.join(content['paths']) + } + headers.update(self.headers) + + response = self.simulate_get(content['paths'][0], headers=headers) + self.assertEqual(falcon.HTTP_404, self.srmock.status) + + headers = { + 'URL-Signature': '', + 'URL-Expires': content['expires'], + 'URL-Methods': ','.join(content['methods']), + 'URL-Paths': ','.join(content['paths']) + } + headers.update(self.headers) + + response = self.simulate_get(content['paths'][0], headers=headers) + self.assertEqual(falcon.HTTP_404, self.srmock.status) + def _get_msg_id(self, headers): return self._get_msg_ids(headers)[0]