Add configurable Deck GUI host allowlist with backup and restore

This commit is contained in:
Mikei386 committed 2026-10-07 20:56:49 +02:00
1 parent b5f161531e
commit 0966abf1b5
14 files changed
+237 -17

No files matched your search

+7
View File
@@ -98,6 +98,13 @@ class APITests(unittest.TestCase):
with self.assertRaises(urllib.error.HTTPError) as error:self.post('network/import',{'config':configuration('PostUp = no')})
self.assertEqual(error.exception.code,400);error.exception.close()
transport.assert_not_called()
def test_hosts_validated_before_transport(self):
with patch.object(self.server.network,'call',return_value={'allowed_hosts':['athena.example.test']}) as transport:
with self.post('network/hosts',{'allowed_hosts':['ATHENA.example.test']}) as result:self.assertEqual(result.status,200)
self.assertEqual(transport.call_args.args[1],{'allowed_hosts':['athena.example.test']})
transport.reset_mock()
with self.assertRaises(urllib.error.HTTPError) as error:self.post('network/hosts',{'allowed_hosts':['https://evil.test']})
self.assertEqual(error.exception.code,400);error.exception.close();transport.assert_not_called()
def test_cannot_forge_confirm_ingress(self):
with patch.object(self.server.network,'call',return_value={}) as transport:
with self.post('network/confirm',{'trial_id':'test'}, {'X-Deck-Ingress':'tunnel'}) as result:self.assertEqual(result.status,200)