mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
fix(gcp): remove Default Project ID requirement (#3459)
This commit is contained in:
@@ -44,15 +44,7 @@ class Audit_Info:
|
||||
|
||||
def print_gcp_credentials(self, audit_info: GCP_Audit_Info):
|
||||
# Beautify audited profile, set "default" if there is no profile set
|
||||
try:
|
||||
getattr(audit_info.credentials, "_service_account_email")
|
||||
profile = (
|
||||
audit_info.credentials._service_account_email
|
||||
if audit_info.credentials._service_account_email is not None
|
||||
else "default"
|
||||
)
|
||||
except AttributeError:
|
||||
profile = "default"
|
||||
profile = getattr(audit_info.credentials, "_service_account_email", "default")
|
||||
|
||||
report = f"""
|
||||
This report is being generated using credentials below:
|
||||
|
||||
@@ -18,9 +18,6 @@ class GCP_Provider:
|
||||
self.credentials, self.default_project_id = self.__set_credentials__(
|
||||
credentials_file
|
||||
)
|
||||
if not self.default_project_id:
|
||||
logger.critical("No Project ID associated to Google Credentials.")
|
||||
sys.exit(1)
|
||||
|
||||
self.project_ids = []
|
||||
accessible_projects = self.get_project_ids()
|
||||
@@ -41,6 +38,10 @@ class GCP_Provider:
|
||||
# If not projects were input, all accessible projects are scanned by default
|
||||
self.project_ids = accessible_projects
|
||||
|
||||
# Set Default Project ID if not set in credentials
|
||||
if not self.default_project_id:
|
||||
self.default_project_id = self.project_ids[0]
|
||||
|
||||
def __set_credentials__(self, credentials_file):
|
||||
try:
|
||||
if credentials_file:
|
||||
|
||||
Reference in New Issue
Block a user