Fix another way mw may encouter invalid swift paths

Related-Change-Id: I8c342c4751ba3ca682efd152e90e396e9f8eb851
Change-Id: I9df32c5aae4e681d488419f36982ffc36589d50a
Signed-off-by: Clay Gerrard <clay.gerrard@gmail.com>
This commit is contained in:
Clay Gerrard
2025-08-06 14:52:31 -05:00
parent 86a1acc9e3
commit a770881b59
2 changed files with 19 additions and 2 deletions

View File

@@ -1223,6 +1223,18 @@ class TestDecrypter(unittest.TestCase):
resp = req.get_response(app)
self.assertEqual(resp.status_int, 404)
def test_invalid_swift_path(self):
path = '/v1/\xC0.\xC0./\xC0.\xC0./\xC0.\xC0./\xC0.\xC0./winnt/win.ini'
fake_swift = FakeSwift()
fake_swift.register('GET', path, HTTPNotFound, {})
app = keymaster.KeyMaster(decrypter.Decrypter(fake_swift, {}), {
'encryption_root_secret': 'A' * 80,
})
app.app.logger = debug_logger()
req = Request.blank(path)
resp = req.get_response(app)
self.assertEqual(resp.status_int, 404)
if __name__ == '__main__':
unittest.main()