From 06952e1f577864cf53da34a80f00ebb0ba5fdf1c Mon Sep 17 00:00:00 2001 From: Sae86 Date: Mon, 2 Oct 2023 10:57:55 -0700 Subject: [PATCH] Update remaining SKIPPED results and references Signed-off-by: Sae86 --- chipsec/module.py | 3 --- chipsec/module_common.py | 3 --- chipsec/modules/common/smm.py | 2 +- chipsec/modules/common/uefi/access_uefispec.py | 2 +- chipsec/modules/tools/secureboot/te.py | 2 +- chipsec/testcase.py | 12 +----------- chipsec_main.py | 2 +- docs/sphinx/usage/Interpreting-Results.rst | 5 +---- tests/hardware/test_elitebook_1040_ubuntu.py | 2 +- tests/hardware/test_generic.py | 4 ++-- tests/hardware/test_x1_carbon_ubuntu.py | 2 +- tests/hardware/test_z420_ubuntu.py | 2 +- 12 files changed, 11 insertions(+), 30 deletions(-) diff --git a/chipsec/module.py b/chipsec/module.py index 76254144de..a5f69e36d1 100644 --- a/chipsec/module.py +++ b/chipsec/module.py @@ -90,9 +90,6 @@ def run(self, module_argv): if self.mod_obj.res == ModuleResult.NOTAPPLICABLE: result = ModuleResult.NOTAPPLICABLE self.logger.log(f'Skipping module {self.name} since it is not applicable in this environment and/or platform') - else: - result = ModuleResult.SKIPPED - self.logger.log(f'Skipping module {self.name} since it is not supported in this environment and/or platform') return result diff --git a/chipsec/module_common.py b/chipsec/module_common.py index 641ad662c2..21a9afc3f0 100644 --- a/chipsec/module_common.py +++ b/chipsec/module_common.py @@ -38,7 +38,6 @@ class ModuleResult: FAILED = 0 PASSED = 1 WARNING = 2 - SKIPPED = 3 DEPRECATED = 4 INFORMATION = 5 NOTAPPLICABLE = 6 @@ -112,7 +111,6 @@ def getReturnCode(self, result: int) -> int: ModuleResult.PASSED: 0, ModuleResult.NOTAPPLICABLE: 0, ModuleResult.DEPRECATED: 0, - ModuleResult.SKIPPED: 0, ModuleResult.INFORMATION: 1, ModuleResult.WARNING: 2, ModuleResult.FAILED: 3, @@ -123,7 +121,6 @@ def getReturnCode(self, result: int) -> int: ModuleResult.FAILED: 'Failed', ModuleResult.PASSED: 'Passed', ModuleResult.WARNING: 'Warning', - ModuleResult.SKIPPED: 'Skipped', ModuleResult.DEPRECATED: 'Deprecated', ModuleResult.INFORMATION: 'Information', ModuleResult.ERROR: 'Error', diff --git a/chipsec/modules/common/smm.py b/chipsec/modules/common/smm.py index 180b636c11..63c4b0722b 100644 --- a/chipsec/modules/common/smm.py +++ b/chipsec/modules/common/smm.py @@ -73,7 +73,7 @@ def check_SMRAMC(self): res = ModuleResult.FAILED self.logger.log_failed("Compatible SMRAM is not properly locked. Expected ( D_LCK = 1, D_OPEN = 0 )") else: - res = ModuleResult.SKIPPED + res = ModuleResult.NOTAPPLICABLE self.logger.log("[*] Compatible SMRAM is not enabled. Skipping..") return res diff --git a/chipsec/modules/common/uefi/access_uefispec.py b/chipsec/modules/common/uefi/access_uefispec.py index 47de6795a3..6a29a77d0b 100644 --- a/chipsec/modules/common/uefi/access_uefispec.py +++ b/chipsec/modules/common/uefi/access_uefispec.py @@ -150,7 +150,7 @@ def check_vars(self, do_modify): if vars is None: self.logger.log_warning('Could not enumerate UEFI Variables from runtime.') self.logger.log_important("Note that UEFI variables may still exist, OS just did not expose runtime UEFI Variable API to read them.\nYou can extract variables directly from ROM file via 'chipsec_util.py uefi nvram bios.bin' command and verify their attributes manually.") - return ModuleResult.SKIPPED + return ModuleResult.WARNING uefispec_concern = [] ro_concern = [] diff --git a/chipsec/modules/tools/secureboot/te.py b/chipsec/modules/tools/secureboot/te.py index 5ce0c36fea..266b47a0fd 100644 --- a/chipsec/modules/tools/secureboot/te.py +++ b/chipsec/modules/tools/secureboot/te.py @@ -536,7 +536,7 @@ def run(self, module_argv): if len(bootloader_paths) == 0: self.logger.log("[*] no bootloaders to replace. Exit...") self.rc_res.setStatusBit(self.rc_res.status.FEATURE_DISABLED) - return self.rc_res.getReturnCode(ModuleResult.SKIPPED) + return self.rc_res.getReturnCode(ModuleResult.WARNING) do_mount = self.cs.os_helper.is_windows() # @TODO if 'restore_bootloader' == mode: diff --git a/chipsec/testcase.py b/chipsec/testcase.py index f0f00018ca..4b0fa171cf 100644 --- a/chipsec/testcase.py +++ b/chipsec/testcase.py @@ -30,7 +30,6 @@ class ExitCode: OK = 0 - SKIPPED = 1 WARNING = 2 DEPRECATED = 4 FAIL = 8 @@ -45,7 +44,6 @@ class ExitCode: CHIPSEC returns an integer exit code: - Exit code is 0: all modules ran successfully and passed - Exit code is not 0: each bit means the following: - - Bit 0: SKIPPED at least one module was skipped for the platform - Bit 1: WARNING at least one module had a warning - Bit 2: DEPRECATED at least one module uses deprecated API - Bit 3: FAIL at least one module failed @@ -122,7 +120,6 @@ def order_summaryL(self) -> Dict[str, List[TestCase]]: failed = [] errors = [] warnings = [] - skipped = [] information = [] notapplicable = [] executed = 0 @@ -137,8 +134,6 @@ def order_summaryL(self) -> Dict[str, List[TestCase]]: errors.append(fields['name']) elif fields['result'] == 'Warning': warnings.append(fields['name']) - elif fields['result'] == 'Skipped': - skipped.append(fields['name']) elif fields['result'] == 'Information': information.append(fields['name']) elif fields['result'] == 'NotApplicable': @@ -149,7 +144,6 @@ def order_summaryL(self) -> Dict[str, List[TestCase]]: ret['information'] = information ret['failed'] = failed ret['warnings'] = warnings - ret['skipped'] = skipped ret['not applicable'] = notapplicable ret['exceptions'] = self.exceptions return ret @@ -164,8 +158,6 @@ def get_return_codeL(self) -> int: return ExitCode.FAIL elif len(summary['warnings']) != 0: return ExitCode.WARNING - elif len(summary['skipped']) != 0: - return ExitCode.SKIPPED elif len(summary['not applicable']) != 0: return ExitCode.NOTAPPLICABLE elif len(summary['information']) != 0: @@ -282,7 +274,6 @@ def markdown_full(self, name: str) -> str: failed = [] error = [] warning = [] - skipped = [] information = [] notapplicable = [] deprecated = [] @@ -290,7 +281,6 @@ def markdown_full(self, name: str) -> str: 'Failed': failed, 'Error': error, 'Warning': warning, - 'Skipped': skipped, 'Information': information, 'NotApplicable': notapplicable, 'Deprecated': deprecated @@ -347,7 +337,7 @@ def print_summaryL(self, runtime: Optional[float] = None) -> None: logger().log_information(mod) elif result == 'failed': logger().log_failed(mod) - elif result in ['not applicable', 'skipped']: + elif result in 'not applicable': logger().log_not_applicable(mod) logger().log('[CHIPSEC] *****************************************************************') diff --git a/chipsec_main.py b/chipsec_main.py index fd91999986..806bc5f1b4 100755 --- a/chipsec_main.py +++ b/chipsec_main.py @@ -166,7 +166,7 @@ def run_module(self, modx, module_argv): if self.verify_module_tags(modx): result = modx.run(module_argv) else: - return module_common.ModuleResult.SKIPPED + return module_common.ModuleResult.NOTAPPLICABLE except BaseException as msg: if self.logger.DEBUG: self.logger.log_bad(traceback.format_exc()) diff --git a/docs/sphinx/usage/Interpreting-Results.rst b/docs/sphinx/usage/Interpreting-Results.rst index 03653ff26a..e616c761ff 100644 --- a/docs/sphinx/usage/Interpreting-Results.rst +++ b/docs/sphinx/usage/Interpreting-Results.rst @@ -12,9 +12,6 @@ messages and meaning of information returned by CHIPSEC. Results ------- -Currently, the SKIPPED return value is ambiguous. The proposed **new** -definition of the return values is listed below: - .. list-table:: Generic results meanings :widths: 25 25 :header-rows: 1 @@ -27,7 +24,7 @@ definition of the return values is listed below: - A known **vulnerability** has been detected * - WARNING - We have detected something that could be a vulnerability but **manual analysis is required** to confirm (inconclusive) - * - NOT_APPLICABLE (SKIPPED) + * - NOT_APPLICABLE - The issue checked by this module is not applicable to this platform. This result can be ignored * - INFORMATION - This module does not check for a vulnerability. It just prints information about the system diff --git a/tests/hardware/test_elitebook_1040_ubuntu.py b/tests/hardware/test_elitebook_1040_ubuntu.py index 9aa319d599..7b9fff0135 100644 --- a/tests/hardware/test_elitebook_1040_ubuntu.py +++ b/tests/hardware/test_elitebook_1040_ubuntu.py @@ -34,7 +34,7 @@ class EliteBook1040UbuntuTest(test_ubuntu.GenericUbuntuTest): "chipsec.modules.smm_dma", ] - SKIPPED = [ + WARNING = [ "chipsec.modules.common.secureboot.variables", "chipsec.modules.common.uefi.s3bootscript", "chipsec.modules.common.uefi.access_uefispec", diff --git a/tests/hardware/test_generic.py b/tests/hardware/test_generic.py index 815ef8822f..1c2eb4342b 100644 --- a/tests/hardware/test_generic.py +++ b/tests/hardware/test_generic.py @@ -72,5 +72,5 @@ def _generic_main(self): "At least one test raised an error") for test in self.PASS: self.assertIn("PASSED: {}".format(test), self.log) - for test in self.SKIPPED: - self.assertIn("SKIPPED: {}".format(test), self.log) + for test in self.WARNING: + self.assertIn("WARNING: {}".format(test), self.log) diff --git a/tests/hardware/test_x1_carbon_ubuntu.py b/tests/hardware/test_x1_carbon_ubuntu.py index 9d0668badd..b40657d66c 100644 --- a/tests/hardware/test_x1_carbon_ubuntu.py +++ b/tests/hardware/test_x1_carbon_ubuntu.py @@ -36,7 +36,7 @@ class X1CarbonUbuntuTest(test_ubuntu.GenericUbuntuTest): "chipsec.modules.smm_dma" ] - SKIPPED = [] + WARNING = [] def test_main(self): self._generic_main() diff --git a/tests/hardware/test_z420_ubuntu.py b/tests/hardware/test_z420_ubuntu.py index a742f455a4..cadfcefa69 100644 --- a/tests/hardware/test_z420_ubuntu.py +++ b/tests/hardware/test_z420_ubuntu.py @@ -33,7 +33,7 @@ class Z420UbuntuTest(test_ubuntu.GenericUbuntuTest): ] # This platform does not support the following tests - SKIPPED = [ + WARNING = [ "chipsec.modules.common.smm", "chipsec.modules.remap", "chipsec.modules.smm_dma"