Compare commits

...

2 Commits

Author SHA1 Message Date
pedrooot
1110eb6350 refactor(custom_metadata): still adding changes 2024-09-26 17:22:58 +02:00
pedrooot
72bbafa344 refactor(check_metadata): remove check metadata loading 2024-09-26 17:08:29 +02:00
3 changed files with 10 additions and 16 deletions

View File

@@ -135,7 +135,7 @@ def prowler():
sys.exit()
# Load checks metadata
logger.debug("Loading checks metadata from .metadata.json files")
logger.debug("Loading checks metadata from <check_name>.metadata.json files")
bulk_checks_metadata = CheckMetadata.get_bulk(provider)
if args.list_categories:
@@ -269,7 +269,6 @@ def prowler():
findings = execute_checks(
checks_to_execute,
global_provider,
custom_checks_metadata,
args.config_file,
output_options,
)

View File

@@ -14,7 +14,6 @@ from colorama import Fore, Style
import prowler
from prowler.config.config import orange_color
from prowler.lib.check.custom_checks_metadata import update_check_metadata
from prowler.lib.check.models import Check
from prowler.lib.check.utils import recover_checks_from_provider
from prowler.lib.logger import logger
@@ -404,7 +403,6 @@ def run_fixer(check_findings: list) -> int:
def execute_checks(
checks_to_execute: list,
global_provider: Any,
custom_checks_metadata: Any,
config_file: str,
output_options: Any,
) -> list:
@@ -474,7 +472,6 @@ def execute_checks(
check_findings = execute(
check,
global_provider,
custom_checks_metadata,
output_options,
)
report(check_findings, global_provider, output_options)
@@ -554,7 +551,6 @@ def execute_checks(
check_findings = execute(
check,
global_provider,
custom_checks_metadata,
output_options,
)
@@ -602,7 +598,6 @@ def execute_checks(
def execute(
check: Check,
global_provider: Any,
custom_checks_metadata: Any,
output_options: Any = None,
):
"""
@@ -619,14 +614,6 @@ def execute(
list: list of findings
"""
try:
# Update check metadata to reflect that in the outputs
if custom_checks_metadata and custom_checks_metadata["Checks"].get(
check.CheckID
):
check = update_check_metadata(
check, custom_checks_metadata["Checks"][check.CheckID]
)
only_logs = False
if hasattr(output_options, "only_logs"):
only_logs = output_options.only_logs

View File

@@ -1,6 +1,7 @@
from typing import Generator
from prowler.lib.check.check import execute, import_check, update_audit_metadata
from prowler.lib.check.custom_checks_metadata import update_check_metadata
from prowler.lib.logger import logger
from prowler.lib.outputs.finding import Finding
from prowler.providers.common.models import Audit_Metadata
@@ -111,11 +112,18 @@ class Scan:
f"Check '{check_name}' was not found for the {self._provider.type.upper()} provider"
)
continue
# Update check metadata to reflect that in the outputs
if custom_checks_metadata and custom_checks_metadata["Checks"].get(
check.CheckID
):
check = update_check_metadata(
check, custom_checks_metadata["Checks"][check.CheckID]
)
# Execute the check
check_findings = execute(
check,
self._provider,
custom_checks_metadata,
output_options=None,
)