From 306fcd299fbcccc1cdab28437014f09390f311dc Mon Sep 17 00:00:00 2001 From: ArnoStiefvater Date: Tue, 21 Jul 2020 09:02:36 +0200 Subject: [PATCH] Do not add options without value We may run into problems on openvas side otherwise. For example adding the empty string for the ifaces_allow option would basically mean that we do not allow any iface. --- ospd_openvas/preferencehandler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ospd_openvas/preferencehandler.py b/ospd_openvas/preferencehandler.py index a0b1aa7e..ac738628 100644 --- a/ospd_openvas/preferencehandler.py +++ b/ospd_openvas/preferencehandler.py @@ -500,6 +500,10 @@ def prepare_scan_params_for_openvas(self, ospd_params: Dict[str, Dict]): val = _from_bool_to_str(value) else: val = str(value) + # Do not add options which only have the empty string as value. + # We may run into problems on openvas side otherwise. + if val == '': + continue prefs_val.append(key + "|||" + val) self.kbdb.add_scan_preferences(self._openvas_scan_id, prefs_val)