Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iam-gcp): add getters in iam_service for gcp #5001

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions prowler/providers/gcp/services/iam/iam_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def __get_service_accounts__(self):
while request is not None:
response = request.execute()

for account in response["accounts"]:
for account in response.get("accounts", []):
self.service_accounts.append(
ServiceAccount(
name=account["name"],
email=account["email"],
display_name=account.get("displayName", ""),
display_name=account["displayName"],
project_id=project_id,
)
)
Expand Down Expand Up @@ -65,7 +65,7 @@ def __get_service_accounts_keys__(self):
)
response = request.execute()

for key in response["keys"]:
for key in response.get("keys", []):
sa.keys.append(
Key(
name=key["name"].split("/")[-1],
Expand Down Expand Up @@ -149,7 +149,7 @@ def __get_contacts__(self):
.contacts()
.list(parent="organizations/" + org.id)
).execute()
if len(response["contacts"]) > 0:
if len(response.get("contacts", [])) > 0:
contacts = True

self.organizations.append(
Expand Down