diff --git a/dart/lib/component/issue_table_component/issue_table_component.dart b/dart/lib/component/issue_table_component/issue_table_component.dart index a7e1c3e84..8ccd59f6b 100644 --- a/dart/lib/component/issue_table_component/issue_table_component.dart +++ b/dart/lib/component/issue_table_component/issue_table_component.dart @@ -18,6 +18,7 @@ class IssueTableComponent extends PaginatedTable implements ScopeAware { 'regions': '', 'technologies': '', 'accounts': '', + 'accounttypes': '', 'names': '', 'arns': '', 'active': null, diff --git a/dart/lib/component/issue_table_component/issue_table_component.html b/dart/lib/component/issue_table_component/issue_table_component.html index ef1de588d..bb2b6fef3 100644 --- a/dart/lib/component/issue_table_component/issue_table_component.html +++ b/dart/lib/component/issue_table_component/issue_table_component.html @@ -31,6 +31,7 @@ Item Name Technology Account + Account Type Region Issue Notes @@ -44,6 +45,7 @@ {{issue.item.name}} {{issue.item.technology}} {{issue.item.account}} + {{issue.item.account_type}} {{issue.item.region}} {{issue.issue}} {{issue.notes}} diff --git a/dart/lib/component/item_table_component/item_table_component.dart b/dart/lib/component/item_table_component/item_table_component.dart index 1bf1e1c2f..96835f8c9 100644 --- a/dart/lib/component/item_table_component/item_table_component.dart +++ b/dart/lib/component/item_table_component/item_table_component.dart @@ -27,6 +27,7 @@ class ItemTableComponent extends PaginatedTable implements DetachAware { 'regions': '', 'technologies': '', 'accounts': '', + 'accounttypes': '', 'names': '', 'arns': '', 'active': null, diff --git a/dart/lib/component/justified_table_component/justified_table_component.dart b/dart/lib/component/justified_table_component/justified_table_component.dart index cf685f913..4ec4679d8 100644 --- a/dart/lib/component/justified_table_component/justified_table_component.dart +++ b/dart/lib/component/justified_table_component/justified_table_component.dart @@ -17,6 +17,7 @@ class JustifiedTableComponent extends PaginatedTable implements ScopeAware { 'regions': '', 'technologies': '', 'accounts': '', + 'accounttypes': '', 'names': '', 'arns': '', 'active': null, diff --git a/dart/lib/component/justified_table_component/justified_table_component.html b/dart/lib/component/justified_table_component/justified_table_component.html index 77aaf493e..21d910a61 100644 --- a/dart/lib/component/justified_table_component/justified_table_component.html +++ b/dart/lib/component/justified_table_component/justified_table_component.html @@ -22,6 +22,7 @@ Item Name Technology Account + Account Type Region Issue Notes @@ -34,6 +35,7 @@ {{issue.item.name}} {{issue.item.technology}} {{issue.item.account}} + {{issue.item.account_type}} {{issue.item.region}} {{issue.issue}} {{issue.notes}} diff --git a/dart/lib/component/revision_table_component/revision_table_component.dart b/dart/lib/component/revision_table_component/revision_table_component.dart index 7f99a06dd..7e66e6e0b 100644 --- a/dart/lib/component/revision_table_component/revision_table_component.dart +++ b/dart/lib/component/revision_table_component/revision_table_component.dart @@ -27,6 +27,7 @@ class RevisionTableComponent extends PaginatedTable implements DetachAware { 'regions': '', 'technologies': '', 'accounts': '', + 'accounttypes': '', 'names': '', 'arns': '', 'active': null, diff --git a/dart/lib/component/revision_table_component/revision_table_component.html b/dart/lib/component/revision_table_component/revision_table_component.html index 3eb716551..99725a43c 100644 --- a/dart/lib/component/revision_table_component/revision_table_component.html +++ b/dart/lib/component/revision_table_component/revision_table_component.html @@ -46,6 +46,7 @@ Active Technology Account + Account Type Region Name Date @@ -58,6 +59,7 @@
{{rev.item.technology}} {{rev.item.account}} + {{rev.item.account_type}} {{rev.item.region}} {{rev.item.name}} {{rev.date_created | date:'medium'}} @@ -89,4 +91,4 @@
- \ No newline at end of file + diff --git a/security_monkey/views/item.py b/security_monkey/views/item.py index 72492490b..b12fc90fb 100644 --- a/security_monkey/views/item.py +++ b/security_monkey/views/item.py @@ -20,6 +20,7 @@ from security_monkey.views import ITEM_LINK_FIELDS from security_monkey.datastore import Item from security_monkey.datastore import Account +from security_monkey.datastore import AccountType from security_monkey.datastore import Technology from security_monkey.datastore import ItemRevision from security_monkey import rbac @@ -138,7 +139,7 @@ def get(self, item_id): # Returns a list of items optionally filtered by -# account, region, name, ctype or id. +# account, account_type, region, name, ctype or id. class ItemList(AuthenticatedService): decorators = [rbac.allow(['View'], ["GET"])] @@ -197,6 +198,7 @@ def get(self): self.reqparse.add_argument('page', type=int, default=1, location='args') self.reqparse.add_argument('regions', type=str, default=None, location='args') self.reqparse.add_argument('accounts', type=str, default=None, location='args') + self.reqparse.add_argument('accounttypes', type=str, default=None, location='args') self.reqparse.add_argument('active', type=str, default=None, location='args') self.reqparse.add_argument('names', type=str, default=None, location='args') self.reqparse.add_argument('arns', type=str, default=None, location='args') @@ -224,6 +226,11 @@ def get(self): accounts = args['accounts'].split(',') query = query.join((Account, Account.id == Item.account_id)) query = query.filter(Account.name.in_(accounts)) + if 'accounttypes' in args: + accounttypes = args['accounttypes'].split(',') + query = query.join((Account, Account.id == Item.account_id)) + query = query.join((AccountType, AccountType.id == Account.account_type_id)) + query = query.filter(AccountType.name.in_(accounttypes)) if 'technologies' in args: technologies = args['technologies'].split(',') query = query.join((Technology, Technology.id == Item.tech_id)) diff --git a/security_monkey/views/item_issue.py b/security_monkey/views/item_issue.py index f5e279268..4322c1e73 100644 --- a/security_monkey/views/item_issue.py +++ b/security_monkey/views/item_issue.py @@ -21,6 +21,7 @@ from security_monkey.datastore import ItemAudit from security_monkey.datastore import Item from security_monkey.datastore import Account +from security_monkey.datastore import AccountType from security_monkey.datastore import Technology from security_monkey.datastore import ItemRevision from security_monkey.datastore import AuditorSettings @@ -59,6 +60,7 @@ def get(self): items: [ { account: "example_account", + account_type: "AWS", justification: null, name: "example_name", technology: "s3", @@ -88,6 +90,7 @@ def get(self): self.reqparse.add_argument('page', type=int, default=1, location='args') self.reqparse.add_argument('regions', type=str, default=None, location='args') self.reqparse.add_argument('accounts', type=str, default=None, location='args') + self.reqparse.add_argument('accounttypes', type=str, default=None, location='args') self.reqparse.add_argument('technologies', type=str, default=None, location='args') self.reqparse.add_argument('names', type=str, default=None, location='args') self.reqparse.add_argument('arns', type=str, default=None, location='args') @@ -112,6 +115,11 @@ def get(self): accounts = args['accounts'].split(',') query = query.join((Account, Account.id == Item.account_id)) query = query.filter(Account.name.in_(accounts)) + if 'accounttypes' in args: + accounttypes = args['accounttypes'].split(',') + query = query.join((Account, Account.id == Item.account_id)) + query = query.join((AccountType, AccountType.id == Account.account_type_id)) + query = query.filter(AccountType.name.in_(accounttypes)) if 'technologies' in args: technologies = args['technologies'].split(',') query = query.join((Technology, Technology.id == Item.tech_id)) @@ -161,6 +169,7 @@ def get(self): item_marshaled = marshal(issue.item.__dict__, ITEM_FIELDS) issue_marshaled = marshal(issue.__dict__, AUDIT_FIELDS) account_marshaled = {'account': issue.item.account.name} + accounttype_marshaled = {'account_type': issue.item.account.account_type.name} technology_marshaled = {'technology': issue.item.technology.name} links = [] @@ -178,6 +187,7 @@ def get(self): item_marshaled.items() + issue_marshaled.items() + account_marshaled.items() + + accounttype_marshaled.items() + technology_marshaled.items()) items_marshaled.append(merged_marshaled) diff --git a/security_monkey/views/revision.py b/security_monkey/views/revision.py index 75fda3009..2e65287e8 100644 --- a/security_monkey/views/revision.py +++ b/security_monkey/views/revision.py @@ -19,6 +19,7 @@ from security_monkey.views import ITEM_FIELDS from security_monkey.datastore import Item from security_monkey.datastore import Account +from security_monkey.datastore import AccountType from security_monkey.datastore import Technology from security_monkey.datastore import ItemRevision from security_monkey import rbac @@ -149,6 +150,7 @@ def get(self): "items": [ { "account": "example_account", + "accounttype": "AWS", "name": "Example Name", "region": "us-east-1", "item_id": 144, @@ -175,6 +177,7 @@ def get(self): self.reqparse.add_argument('active', type=str, default=None, location='args') self.reqparse.add_argument('regions', type=str, default=None, location='args') self.reqparse.add_argument('accounts', type=str, default=None, location='args') + self.reqparse.add_argument('accounttypes', type=str, default=None, location='args') self.reqparse.add_argument('names', type=str, default=None, location='args') self.reqparse.add_argument('arns', type=str, default=None, location='args') self.reqparse.add_argument('technologies', type=str, default=None, location='args') @@ -195,6 +198,11 @@ def get(self): accounts = args['accounts'].split(',') query = query.join((Account, Account.id == Item.account_id)) query = query.filter(Account.name.in_(accounts)) + if 'accounttypes' in args: + accounttypes = args['accounttypes'].split(',') + query = query.join((Account, Account.id == Item.account_id)) + query = query.join((AccountType, AccountType.id == Account.account_type_id)) + query = query.filter(AccountType.name.in_(accounttypes)) if 'technologies' in args: technologies = args['technologies'].split(',') query = query.join((Technology, Technology.id == Item.tech_id)) @@ -225,11 +233,13 @@ def get(self): item_marshaled = marshal(revision.item.__dict__, ITEM_FIELDS) revision_marshaled = marshal(revision.__dict__, REVISION_FIELDS) account_marshaled = {'account': revision.item.account.name} + accounttype_marshaled = {'account_type': revision.item.account.account_type.name} technology_marshaled = {'technology': revision.item.technology.name} merged_marshaled = dict( item_marshaled.items() + revision_marshaled.items() + account_marshaled.items() + + accounttype_marshaled.items() + technology_marshaled.items()) items_marshaled.append(merged_marshaled)