fix(check): break circular import between config and check.utils (#10895)

This commit is contained in:
Andoni Alonso
2026-04-27 10:11:50 +02:00
committed by GitHub
parent b668770480
commit af2930130c
3 changed files with 18 additions and 6 deletions
+10 -5
View File
@@ -10,6 +10,15 @@ import yaml
from packaging import version
from prowler.lib.check.compliance_models import load_compliance_framework_universal
# Re-exported from a leaf module so prowler.lib.check.utils can import the
# constant without participating in the config <-> compliance_models <-> utils
# import cycle. Existing consumers continue to import from this module.
# The `as EXTERNAL_TOOL_PROVIDERS` rename is the PEP 484 explicit re-export
# form so static analyzers (CodeQL, mypy, ruff) treat the name as public.
from prowler.lib.check.external_tool_providers import ( # noqa: F401
EXTERNAL_TOOL_PROVIDERS as EXTERNAL_TOOL_PROVIDERS,
)
from prowler.lib.logger import logger
@@ -69,10 +78,6 @@ class Provider(str, Enum):
VERCEL = "vercel"
# Providers that delegate scanning to an external tool (e.g. Trivy, promptfoo)
# and bypass standard check/service loading.
EXTERNAL_TOOL_PROVIDERS = frozenset({"iac", "llm", "image"})
# Compliance
actual_directory = pathlib.Path(os.path.dirname(os.path.realpath(__file__)))
@@ -152,7 +157,7 @@ def set_output_timestamp(
Override the global output timestamps so generated artifacts reflect a specific scan.
Returns the previous values so callers can restore them afterwards.
"""
global timestamp, timestamp_utc, output_file_timestamp, timestamp_iso
global output_file_timestamp, timestamp_iso
previous_values = (
timestamp.value,
@@ -0,0 +1,7 @@
# Providers that delegate scanning to an external tool (e.g. Trivy, promptfoo)
# and bypass standard check/service loading.
#
# Kept in a leaf module with no imports so it can be referenced from both
# prowler.config.config and prowler.lib.check.utils without forming an
# import cycle.
EXTERNAL_TOOL_PROVIDERS = frozenset({"iac", "llm", "image"})
+1 -1
View File
@@ -2,7 +2,7 @@ import importlib
import sys
from pkgutil import walk_packages
from prowler.config.config import EXTERNAL_TOOL_PROVIDERS
from prowler.lib.check.external_tool_providers import EXTERNAL_TOOL_PROVIDERS
from prowler.lib.logger import logger