mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-04 19:21:51 +00:00
chore(mutelist): enforce for all providers (#3554)
This commit is contained in:
@@ -49,8 +49,7 @@ class AwsProvider(Provider):
|
||||
_audit_config: dict
|
||||
_ignore_unused_services: bool = False
|
||||
_enabled_regions: set = set()
|
||||
# TODO: enforce the mutelist for the Provider class
|
||||
_mutelist: dict = {}
|
||||
_mutelist: dict
|
||||
_output_options: AWSOutputOptions
|
||||
# TODO: this is not optional, enforce for all providers
|
||||
audit_metadata: Audit_Metadata
|
||||
|
||||
@@ -29,8 +29,7 @@ class AzureProvider(Provider):
|
||||
_region_config: AzureRegionConfig
|
||||
_locations: dict
|
||||
_output_options: AzureOutputOptions
|
||||
# TODO: enforce the mutelist for the Provider class
|
||||
# _mutelist: dict = {}
|
||||
_mutelist: dict
|
||||
# TODO: this is not optional, enforce for all providers
|
||||
audit_metadata: Audit_Metadata
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import importlib
|
||||
import sys
|
||||
|
||||
from prowler.lib.logger import logger
|
||||
|
||||
|
||||
def set_provider_mutelist(provider, audit_info, args):
|
||||
"""
|
||||
set_provider_mutelist configures the mutelist based on the selected provider.
|
||||
"""
|
||||
try:
|
||||
# Check if the provider arguments has the mutelist_file
|
||||
if hasattr(args, "mutelist_file"):
|
||||
# Dynamically get the Provider mutelist handler
|
||||
provider_mutelist_function = f"set_{provider}_mutelist"
|
||||
mutelist_file = getattr(
|
||||
importlib.import_module(__name__), provider_mutelist_function
|
||||
)(audit_info, args.mutelist_file)
|
||||
|
||||
return mutelist_file
|
||||
except Exception as error:
|
||||
logger.critical(
|
||||
f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
sys.exit(1)
|
||||
@@ -99,3 +99,21 @@ class Provider(ABC):
|
||||
|
||||
This is a fallback that returns None if the service has not implemented this function.
|
||||
"""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def mutelist(self):
|
||||
"""
|
||||
mutelist method returns the provider's mutelist.
|
||||
|
||||
This method needs to be created in each provider.
|
||||
"""
|
||||
|
||||
@mutelist.setter
|
||||
@abstractmethod
|
||||
def mutelist(self, path: str):
|
||||
"""
|
||||
mutelist.setter sets the provider's mutelist.
|
||||
|
||||
This method needs to be created in each provider.
|
||||
"""
|
||||
|
||||
@@ -26,10 +26,8 @@ class GcpProvider(Provider):
|
||||
_project_ids: list
|
||||
_identity: GCPIdentityInfo
|
||||
_audit_config: dict
|
||||
|
||||
_output_options: GCPOutputOptions
|
||||
# TODO: enforce the mutelist for the Provider class
|
||||
# _mutelist: dict = {}
|
||||
_mutelist: dict
|
||||
# TODO: this is not optional, enforce for all providers
|
||||
audit_metadata: Audit_Metadata
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ class KubernetesProvider(Provider):
|
||||
_audit_config: dict
|
||||
_identity: KubernetesIdentityInfo
|
||||
_output_options: KubernetesOutputOptions
|
||||
# TODO: enforce the mutelist for the Provider class
|
||||
# _mutelist: dict = {}
|
||||
_mutelist: dict
|
||||
# TODO: this is not optional, enforce for all providers
|
||||
audit_metadata: Audit_Metadata
|
||||
|
||||
|
||||
Reference in New Issue
Block a user