From b5df924dd252aeeef9faa4a50bdbfafa92cd5a43 Mon Sep 17 00:00:00 2001 From: Patrick Kelley Date: Tue, 16 May 2017 23:36:40 +0000 Subject: [PATCH] Updating cloudauxwatchers with ephemeral sections to set instance variables instead of class variables. --- security_monkey/watchers/iam/iam_user.py | 11 +++++++---- security_monkey/watchers/s3.py | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/security_monkey/watchers/iam/iam_user.py b/security_monkey/watchers/iam/iam_user.py index 212ed6d35..e4b2165c0 100644 --- a/security_monkey/watchers/iam/iam_user.py +++ b/security_monkey/watchers/iam/iam_user.py @@ -7,13 +7,16 @@ class IAMUser(CloudAuxWatcher): index = 'iamuser' i_am_singular = 'IAM User' i_am_plural = 'IAM Users' - honor_ephemerals = True - ephemeral_paths = [ - "PasswordLastUsed", + + def __init__(self, *args, **kwargs): + super(IAMUser, self).__init__(*args, **kwargs) + self.honor_ephemerals = True + self.ephemeral_paths = [ + "PasswordLastUsed", "AccessKeys$*$LastUsedDate", "AccessKeys$*$Region", "AccessKeys$*$ServiceName"] - override_region = 'universal' + self.override_region = 'universal' def get_name_from_list_output(self, item): return item['UserName'] diff --git a/security_monkey/watchers/s3.py b/security_monkey/watchers/s3.py index 87bdf39dd..82b132053 100644 --- a/security_monkey/watchers/s3.py +++ b/security_monkey/watchers/s3.py @@ -8,9 +8,12 @@ class S3(CloudAuxWatcher): index = 's3' i_am_singular = 'S3 Bucket' i_am_plural = 'S3 Buckets' - honor_ephemerals = True - ephemeral_paths = ['GrantReferences'] - service_name = 's3' + + def __init__(self, *args, **kwargs): + super(S3, self).__init__(*args, **kwargs) + self.honor_ephemerals = True + self.ephemeral_paths = ['GrantReferences'] + self.service_name = 's3' def list_method(self, **kwargs): buckets = list_buckets(**kwargs)['Buckets']