Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions ScoutSuite/providers/kubernetes/facade/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from json import dumps, loads
from typing import Callable
from yaml import safe_dump

from google.auth.credentials import Credentials as GCPCredentials
Expand All @@ -16,7 +15,7 @@


class KubernetesBaseFacade:
def continue_upon_exception(function: Callable):
def continue_upon_exception(function):
def continue_upon_exception_callback(self, **kwargs):
try:
return function(self, **kwargs)
Expand Down
15 changes: 13 additions & 2 deletions ScoutSuite/providers/kubernetes/facade/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,19 @@ def get_resources(self) -> dict:
# Redact sensitive resources
if kind in ['Secret']:
for i in range(len(resources)):
for key in resources[i]['data']:
resources[i]['data'][key] = 'REDACTED'
# Do not naively assume all secrets have `data`
secret_data = resources[i].get('data')
if not secret_data: continue

# Do not assume `data` is a dictionary either
if type(secret_data) == dict:
for key in secret_data:
resources[i]['data'][key] = 'REDACTED'
elif type(secret_data) == str:
resources[i]['data'] = 'REDACTED'
elif type(secret_data) == list:
for j in range(len(secret_data)):
resources[i]['data'][j] = 'REDACTED'

data[kind] = data.get(kind, {})
data[kind][version] = resources
Expand Down