From 86d4894091b344e89eb292594e366bf06909a873 Mon Sep 17 00:00:00 2001 From: Mike Urbanski Date: Fri, 16 Aug 2024 14:57:53 -0500 Subject: [PATCH] add comment --- checkov/common/checks_infra/registry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/checkov/common/checks_infra/registry.py b/checkov/common/checks_infra/registry.py index a9ba99ead61..0aa8a719302 100644 --- a/checkov/common/checks_infra/registry.py +++ b/checkov/common/checks_infra/registry.py @@ -41,6 +41,11 @@ def __init__(self, checks_dir: str, parser: BaseGraphCheckParser | None = None) def load_checks(self) -> None: if not self.checks: self._load_checks_from_dir(self.checks_dir, False) + + # the first time this runs, custom_policies_checks will not have been set yet, so we don't want to prematurely mark + # custom policies as loaded. + # this does mean that for a registry that has no custom policies to load, this condition will never be skipped (but it will also have no effect) + # maybe there is a better way to do it if not self.custom_policies_loaded and self.custom_policies_checks: self.checks += self.custom_policies_checks self.custom_policies_loaded = True