qubes.NotifyTools: ignore '/qubes-tools/version' completely
It isn't used for anything, so simply ignore it for good. https://github.com/QubesOS/qubes-core-admin/pull/109#discussion_r121421409
This commit is contained in:
parent
55669c350c
commit
86a935e779
@ -75,7 +75,7 @@ class QubesMiscAPI(qubes.api.AbstractQubesAPI):
|
||||
|
||||
untrusted_features = {}
|
||||
safe_set = string.ascii_letters + string.digits
|
||||
expected_features = ('version', 'qrexec', 'gui', 'default-user')
|
||||
expected_features = ('qrexec', 'gui', 'default-user')
|
||||
for feature in expected_features:
|
||||
untrusted_value = self.src.qdb.read('/qubes-tools/' + feature)
|
||||
if untrusted_value:
|
||||
|
@ -31,12 +31,6 @@ class CoreFeatures(qubes.ext.Extension):
|
||||
'Ignoring qubes.NotifyTools for template-based VM')
|
||||
return
|
||||
|
||||
# for now used only to check for the tools presence
|
||||
if 'version' in untrusted_features:
|
||||
# any suspicious string will raise exception here,
|
||||
# but otherwise ignored
|
||||
int(untrusted_features['version'])
|
||||
|
||||
requested_features = {}
|
||||
for feature in ('qrexec', 'gui'):
|
||||
untrusted_value = untrusted_features.get(feature, None)
|
||||
|
@ -125,13 +125,11 @@ class TC_00_API_Misc(qubes.tests.QubesTestCase):
|
||||
mock.call.save()
|
||||
])
|
||||
self.assertEqual(self.src.mock_calls, [
|
||||
mock.call.qdb.read('/qubes-tools/version'),
|
||||
mock.call.qdb.read('/qubes-tools/qrexec'),
|
||||
mock.call.qdb.read('/qubes-tools/gui'),
|
||||
mock.call.qdb.read('/qubes-tools/default-user'),
|
||||
mock.call.fire_event('features-request', untrusted_features={
|
||||
'gui': '1',
|
||||
'version': '1',
|
||||
'default-user': 'user',
|
||||
'qrexec': '1'}),
|
||||
])
|
||||
@ -148,7 +146,6 @@ class TC_00_API_Misc(qubes.tests.QubesTestCase):
|
||||
response = self.call_mgmt_func(b'qubes.NotifyTools')
|
||||
self.assertIsNone(response)
|
||||
self.assertEqual(self.src.mock_calls, [
|
||||
mock.call.qdb.read('/qubes-tools/version'),
|
||||
mock.call.qdb.read('/qubes-tools/qrexec'),
|
||||
mock.call.qdb.read('/qubes-tools/gui'),
|
||||
mock.call.qdb.read('/qubes-tools/default-user'),
|
||||
@ -159,23 +156,6 @@ class TC_00_API_Misc(qubes.tests.QubesTestCase):
|
||||
])
|
||||
self.assertEqual(self.app.mock_calls, [mock.call.save()])
|
||||
|
||||
def test_014_notify_tools_invalid_version(self):
|
||||
qdb_entries = {
|
||||
'/qubes-tools/version': b'this is invalid',
|
||||
'/qubes-tools/qrexec': b'0',
|
||||
'/qubes-tools/gui': b'0',
|
||||
'/qubes-tools/os': b'Linux',
|
||||
'/qubes-tools/default-user': b'user',
|
||||
}
|
||||
self.configure_qdb(qdb_entries)
|
||||
with self.assertRaises(AssertionError):
|
||||
self.call_mgmt_func(b'qubes.NotifyTools')
|
||||
# should be rejected later
|
||||
self.assertEqual(self.src.mock_calls, [
|
||||
mock.call.qdb.read('/qubes-tools/version'),
|
||||
])
|
||||
self.assertEqual(self.app.mock_calls, [])
|
||||
|
||||
def test_015_notify_tools_invalid_value_qrexec(self):
|
||||
qdb_entries = {
|
||||
'/qubes-tools/version': b'1',
|
||||
@ -189,7 +169,6 @@ class TC_00_API_Misc(qubes.tests.QubesTestCase):
|
||||
self.call_mgmt_func(b'qubes.NotifyTools')
|
||||
self.assertEqual(self.app.mock_calls, [])
|
||||
self.assertEqual(self.src.mock_calls, [
|
||||
mock.call.qdb.read('/qubes-tools/version'),
|
||||
mock.call.qdb.read('/qubes-tools/qrexec'),
|
||||
])
|
||||
|
||||
@ -206,7 +185,6 @@ class TC_00_API_Misc(qubes.tests.QubesTestCase):
|
||||
self.call_mgmt_func(b'qubes.NotifyTools')
|
||||
self.assertEqual(self.app.mock_calls, [])
|
||||
self.assertEqual(self.src.mock_calls, [
|
||||
mock.call.qdb.read('/qubes-tools/version'),
|
||||
mock.call.qdb.read('/qubes-tools/qrexec'),
|
||||
mock.call.qdb.read('/qubes-tools/gui'),
|
||||
])
|
||||
|
@ -101,18 +101,6 @@ class TC_00_CoreFeatures(qubes.tests.QubesTestCase):
|
||||
('fire_event', ('template-postinstall',), {})
|
||||
])
|
||||
|
||||
def test_014_notify_tools_invalid_version(self):
|
||||
del self.vm.template
|
||||
with self.assertRaises(ValueError):
|
||||
self.ext.qubes_features_request(self.vm, 'features-request',
|
||||
untrusted_features={
|
||||
'version': 'this is invalid',
|
||||
'qrexec': '1',
|
||||
'gui': '1',
|
||||
'default-user': 'user',
|
||||
})
|
||||
self.assertEqual(self.vm.mock_calls, [])
|
||||
|
||||
def test_015_notify_tools_invalid_value_qrexec(self):
|
||||
del self.vm.template
|
||||
self.ext.qubes_features_request(self.vm, 'features-request',
|
||||
|
Loading…
Reference in New Issue
Block a user