code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def inspect_serviceaccount(self, item):
"""
Driver for ServiceAccount. Calls helpers as needed.
return: (bool, [list of AuditIssues])
"""
errors = []
err = self._max_keys(item.config.get('keys'))
errors.extend(err) if err else None
policies = item.confi... |
Driver for ServiceAccount. Calls helpers as needed.
return: (bool, [list of AuditIssues])
| inspect_serviceaccount | python | Netflix/security_monkey | security_monkey/auditors/gcp/iam/serviceaccount.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/gcp/iam/serviceaccount.py | Apache-2.0 |
def check_for_public_repo(self, org_item):
"""
Organizational view that it has public repositories. Default score of 0. This is mostly
informational.
:param org_item:
:return:
"""
tag = "Organization contains public repositories."
if org_item.config["publ... |
Organizational view that it has public repositories. Default score of 0. This is mostly
informational.
:param org_item:
:return:
| check_for_public_repo | python | Netflix/security_monkey | security_monkey/auditors/github/org.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/org.py | Apache-2.0 |
def check_for_non_twofa_members(self, org_item):
"""
Alert if the org has users that don't have 2FA enabled.
Will keep this at a level of 2 -- unles there are admins without 2FA, then that is level 10!
:param org_item:
:return:
"""
tag = "Organization contains us... |
Alert if the org has users that don't have 2FA enabled.
Will keep this at a level of 2 -- unles there are admins without 2FA, then that is level 10!
:param org_item:
:return:
| check_for_non_twofa_members | python | Netflix/security_monkey | security_monkey/auditors/github/org.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/org.py | Apache-2.0 |
def check_for_public_repo(self, repo_item):
"""
Alert when a repo is public. This may be benign, so we will assign by default, a score of 5.
:param repo_item:
:return:
"""
tag = "Repo is public."
if repo_item.config.get("private") is not None:
if not ... |
Alert when a repo is public. This may be benign, so we will assign by default, a score of 5.
:param repo_item:
:return:
| check_for_public_repo | python | Netflix/security_monkey | security_monkey/auditors/github/repo.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/repo.py | Apache-2.0 |
def check_if_forked_repo(self, repo_item):
"""
Alert if a repo is a fork. Default score of 3
:param repo_item:
:return:
"""
# GitHub doesn't provide a simple way to get the source of the fork for some reason... :/
tag = "Repo is a fork of another repo."
i... |
Alert if a repo is a fork. Default score of 3
:param repo_item:
:return:
| check_if_forked_repo | python | Netflix/security_monkey | security_monkey/auditors/github/repo.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/repo.py | Apache-2.0 |
def check_for_no_protected_branches(self, repo_item):
"""
Alert when a repo has 0 protected branches. This may be worth having for informational purposes.
:param repo_item:
:return:
"""
tag = "Repo has no protected branches."
if len(repo_item.config["protected_br... |
Alert when a repo has 0 protected branches. This may be worth having for informational purposes.
:param repo_item:
:return:
| check_for_no_protected_branches | python | Netflix/security_monkey | security_monkey/auditors/github/repo.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/repo.py | Apache-2.0 |
def check_for_deploy_keys(self, repo_item):
"""
Alert when a repo has deploy keys set. This may be benign, so we will assign by default, a score of 3.
:param repo_item:
:return:
"""
tag = "Repo has deploy keys."
push_tag = "Deploy key has PUSH access to the repo"
... |
Alert when a repo has deploy keys set. This may be benign, so we will assign by default, a score of 3.
:param repo_item:
:return:
| check_for_deploy_keys | python | Netflix/security_monkey | security_monkey/auditors/github/repo.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/repo.py | Apache-2.0 |
def check_for_outside_collaborators(self, repo_item):
"""
Alert when repo has outside collaborators, as well as outside collaborators having admin access.
:param repo_item:
:return:
"""
oc_tag = "Repo has outside collaborators."
admin_oc_tag = "Repo has administra... |
Alert when repo has outside collaborators, as well as outside collaborators having admin access.
:param repo_item:
:return:
| check_for_outside_collaborators | python | Netflix/security_monkey | security_monkey/auditors/github/repo.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/repo.py | Apache-2.0 |
def check_for_admin_teams(self, repo_item):
"""
Alert when repo has a team with admin permissions attached. Score = 3
:param repo_item:
:return:
"""
tag = "Repo has teams with admin permissions."
for permission in itervalues(repo_item.config["team_permissions"]):... |
Alert when repo has a team with admin permissions attached. Score = 3
:param repo_item:
:return:
| check_for_admin_teams | python | Netflix/security_monkey | security_monkey/auditors/github/repo.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/repo.py | Apache-2.0 |
def check_for_public_team(self, team_item):
"""
Teams that have the privacy flag set to "closed" are publicly visible.
:param team_item:
:return:
"""
tag = "This team is no secret... to people in the org."
if team_item.config["privacy"] == "closed":
s... |
Teams that have the privacy flag set to "closed" are publicly visible.
:param team_item:
:return:
| check_for_public_team | python | Netflix/security_monkey | security_monkey/auditors/github/team.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/github/team.py | Apache-2.0 |
def check_star_privileges(self, item):
"""
alert when an IAM Object has a policy allowing '*'.
"""
issue = Categories.ADMIN_ACCESS
notes = Categories.ADMIN_ACCESS_NOTES
for policy in self.load_iam_policies(item):
for statement in policy.statements:
... |
alert when an IAM Object has a policy allowing '*'.
| check_star_privileges | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_iam_star_privileges(self, item):
"""
alert when an IAM Object has a policy allowing 'iam:*'.
"""
issue = Categories.ADMIN_ACCESS
notes = Categories.ADMIN_ACCESS_NOTES
for policy in self.load_iam_policies(item):
for statement in policy.statements:
... |
alert when an IAM Object has a policy allowing 'iam:*'.
| check_iam_star_privileges | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_permissions(self, item):
"""
Alert when an IAM Object has a policy allowing permission modification.
"""
issue = Categories.SENSITIVE_PERMISSIONS
notes = Categories.SENSITIVE_PERMISSIONS_NOTES_2
for policy in self.load_iam_policies(item):
for statem... |
Alert when an IAM Object has a policy allowing permission modification.
| check_permissions | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_mutable_sensitive_services(self, item):
"""
Alert when an IAM Object has DataPlaneMutating permissions for sensitive services.
"""
issue = Categories.SENSITIVE_PERMISSIONS
notes = Categories.SENSITIVE_PERMISSIONS_NOTES_2
sensitive_services = app.config.get('SEN... |
Alert when an IAM Object has DataPlaneMutating permissions for sensitive services.
| check_mutable_sensitive_services | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_iam_passrole(self, item):
"""
alert when an IAM Object has a policy allowing 'iam:PassRole'.
This allows the object to pass any role specified in the resource block to an ec2 instance.
"""
issue = Categories.SENSITIVE_PERMISSIONS
notes = Categories.SENSITIVE_PER... |
alert when an IAM Object has a policy allowing 'iam:PassRole'.
This allows the object to pass any role specified in the resource block to an ec2 instance.
| check_iam_passrole | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_notaction(self, item):
"""
alert when an IAM Object has a policy containing 'NotAction'.
NotAction combined with an "Effect": "Allow" often provides more privilege
than is desired.
"""
issue = Categories.STATEMENT_CONSTRUCTION
notes = Categories.STATEMEN... |
alert when an IAM Object has a policy containing 'NotAction'.
NotAction combined with an "Effect": "Allow" often provides more privilege
than is desired.
| check_notaction | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_notresource(self, item):
"""
alert when an IAM Object has a policy containing 'NotResoure'.
NotResource combined with an "Effect": "Allow" often provides more privilege
than is desired.
"""
issue = Categories.STATEMENT_CONSTRUCTION
notes = Categories.STA... |
alert when an IAM Object has a policy containing 'NotResoure'.
NotResource combined with an "Effect": "Allow" often provides more privilege
than is desired.
| check_notresource | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_security_group_permissions(self, item):
"""
alert when an IAM Object has ec2:AuthorizeSecurityGroupEgress or ec2:AuthorizeSecurityGroupIngress.
"""
issue = Categories.SENSITIVE_PERMISSIONS
notes = Categories.SENSITIVE_PERMISSIONS_NOTES_1
permissions = {"ec2:aut... |
alert when an IAM Object has ec2:AuthorizeSecurityGroupEgress or ec2:AuthorizeSecurityGroupIngress.
| check_security_group_permissions | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def library_check_attached_managed_policies(self, iam_item, iam_type):
"""
alert when an IAM item (group, user or role) is attached to a managed policy with issues
"""
mp_items = self.get_auditor_support_items(ManagedPolicy.index, iam_item.account)
managed_policies = iam_item.con... |
alert when an IAM item (group, user or role) is attached to a managed policy with issues
| library_check_attached_managed_policies | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_policy.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_policy.py | Apache-2.0 |
def check_cert_size_lt_1024(self, cert_item):
"""
alert when a cert is using less than 1024 bits
"""
size = cert_item.config.get('size', None)
if size and size < 1024:
notes = 'Actual size is {0} bits.'.format(size)
self.add_issue(10, 'Cert size is less th... |
alert when a cert is using less than 1024 bits
| check_cert_size_lt_1024 | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_ssl.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_ssl.py | Apache-2.0 |
def check_cert_size_lt_2048(self, cert_item):
"""
alert when a cert is using less than 2048 bits
"""
size = cert_item.config.get('size', None)
if size and 1024 <= size < 2048:
notes = 'Actual size is {0} bits.'.format(size)
self.add_issue(3, 'Cert size is ... |
alert when a cert is using less than 2048 bits
| check_cert_size_lt_2048 | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_ssl.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_ssl.py | Apache-2.0 |
def check_signature_algorith_for_md5(self, cert_item):
"""
alert when a cert is using md5 for the hashing part
of the signature algorithm
"""
sig_alg = cert_item.config.get('signature_algorithm', None)
if sig_alg and 'md5' in sig_alg.lower():
self.add_issue(3... |
alert when a cert is using md5 for the hashing part
of the signature algorithm
| check_signature_algorith_for_md5 | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_ssl.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_ssl.py | Apache-2.0 |
def check_signature_algorith_for_sha1(self, cert_item):
"""
alert when a cert is using sha1 for the hashing part of
its signature algorithm.
Microsoft and Google are aiming to drop support for sha1 by January 2017.
"""
sig_alg = cert_item.config.get('signature_algorithm'... |
alert when a cert is using sha1 for the hashing part of
its signature algorithm.
Microsoft and Google are aiming to drop support for sha1 by January 2017.
| check_signature_algorith_for_sha1 | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_ssl.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_ssl.py | Apache-2.0 |
def check_upload_date_for_heartbleed(self, cert_item):
"""
alert when a cert was uploaded pre-heartbleed.
"""
upload = cert_item.config.get('upload_date', None)
if upload:
upload = parser.parse(upload)
heartbleed = parser.parse(HEARTBLEED_DATE)
... |
alert when a cert was uploaded pre-heartbleed.
| check_upload_date_for_heartbleed | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_ssl.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_ssl.py | Apache-2.0 |
def prep_for_audit(self):
"""
Prepare for the audit by calculating 90 days ago.
This is used to check if access keys have been rotated.
"""
super(IAMUserAuditor, self).prep_for_audit()
now = datetime.datetime.now()
then = now - datetime.timedelta(days=90)
... |
Prepare for the audit by calculating 90 days ago.
This is used to check if access keys have been rotated.
| prep_for_audit | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_user.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_user.py | Apache-2.0 |
def check_active_access_keys(self, item):
"""
alert when an IAM User has an active access key.
score: 1
"""
issue = Categories.INFORMATIONAL
notes = Categories.INFORMATIONAL_NOTES
akeys = item.config.get('AccessKeys', {})
for akey in akeys:
if... |
alert when an IAM User has an active access key.
score: 1
| check_active_access_keys | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_user.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_user.py | Apache-2.0 |
def check_inactive_access_keys(self, item):
"""
alert when an IAM User has an inactive access key.
score: 0
"""
issue = Categories.INFORMATIONAL
notes = Categories.INFORMATIONAL_NOTES
akeys = item.config.get('AccessKeys', {})
for akey in akeys:
... |
alert when an IAM User has an inactive access key.
score: 0
| check_inactive_access_keys | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_user.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_user.py | Apache-2.0 |
def check_access_key_rotation(self, item):
"""
alert when an IAM User has an active access key created more than 90 days go.
"""
issue = Categories.ROTATION
notes = Categories.ROTATION_NOTES
requirement = '> 90 days ago'
akeys = item.config.get('AccessKeys', {})
... |
alert when an IAM User has an active access key created more than 90 days go.
| check_access_key_rotation | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_user.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_user.py | Apache-2.0 |
def check_access_key_last_used(self, item):
"""
alert if an active access key hasn't been used in 90 days
"""
issue = Categories.UNUSED
notes = Categories.UNUSED_NOTES
requirement = '> 90 days ago'
akeys = item.config.get('AccessKeys', {})
for akey in ake... |
alert if an active access key hasn't been used in 90 days
| check_access_key_last_used | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_user.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_user.py | Apache-2.0 |
def check_no_mfa(self, item):
"""
alert when an IAM user has a login profile and no MFA devices.
This means a human account which could be better protected with 2FA.
"""
issue = Categories.INSECURE_CONFIGURATION
notes = Categories.INSECURE_CONFIGURATION_NOTES
note... |
alert when an IAM user has a login profile and no MFA devices.
This means a human account which could be better protected with 2FA.
| check_no_mfa | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_user.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_user.py | Apache-2.0 |
def check_loginprofile_plus_akeys(self, item):
"""
alert when an IAM user has a login profile and API access via access keys.
An account should be used Either for API access OR for console access, but maybe not both.
"""
if not item.config.get('LoginProfile', None):
r... |
alert when an IAM user has a login profile and API access via access keys.
An account should be used Either for API access OR for console access, but maybe not both.
| check_loginprofile_plus_akeys | python | Netflix/security_monkey | security_monkey/auditors/iam/iam_user.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/iam/iam_user.py | Apache-2.0 |
def check_rds_ec2_rfc1918(self, sg_item):
"""
alert if non-vpc RDS SG contains RFC1918 CIDRS
"""
tag = "Non-VPC RDS Security Group contains private RFC-1918 CIDR"
severity = 8
if sg_item.config.get("vpc_id", None):
return
for ipr in sg_item.config.ge... |
alert if non-vpc RDS SG contains RFC1918 CIDRS
| check_rds_ec2_rfc1918 | python | Netflix/security_monkey | security_monkey/auditors/rds/rds_security_group.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/rds/rds_security_group.py | Apache-2.0 |
def check_securitygroup_large_subnet(self, sg_item):
"""
Make sure the RDS SG does not contain large networks.
"""
tag = "RDS Security Group network larger than /24"
severity = 3
for ipr in sg_item.config.get("ip_ranges", []):
cidr = ipr.get("cidr_ip", None)
... |
Make sure the RDS SG does not contain large networks.
| check_securitygroup_large_subnet | python | Netflix/security_monkey | security_monkey/auditors/rds/rds_security_group.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/rds/rds_security_group.py | Apache-2.0 |
def check_securitygroup_zero_subnet(self, sg_item):
"""
Make sure the RDS SG does not contain a cidr with a subnet length of zero.
"""
tag = "RDS Security Group subnet mask is /0"
severity = 10
for ipr in sg_item.config.get("ip_ranges", []):
cidr = ipr.get("ci... |
Make sure the RDS SG does not contain a cidr with a subnet length of zero.
| check_securitygroup_zero_subnet | python | Netflix/security_monkey | security_monkey/auditors/rds/rds_security_group.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/rds/rds_security_group.py | Apache-2.0 |
def check_securitygroup_any(self, sg_item):
"""
Make sure the RDS SG does not contain 0.0.0.0/0
"""
tag = "RDS Security Group contains 0.0.0.0/0"
severity = 5
for ipr in sg_item.config.get("ip_ranges", []):
cidr = ipr.get("cidr_ip")
if "0.0.0.0/0" ... |
Make sure the RDS SG does not contain 0.0.0.0/0
| check_securitygroup_any | python | Netflix/security_monkey | security_monkey/auditors/rds/rds_security_group.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/rds/rds_security_group.py | Apache-2.0 |
def check_securitygroup_10net(self, sg_item):
"""
Make sure the RDS SG does not contain 10.0.0.0/8
"""
tag = "RDS Security Group contains 10.0.0.0/8"
severity = 5
for ipr in sg_item.config.get("ip_ranges", []):
cidr = ipr.get("cidr_ip")
if "10.0.0... |
Make sure the RDS SG does not contain 10.0.0.0/8
| check_securitygroup_10net | python | Netflix/security_monkey | security_monkey/auditors/rds/rds_security_group.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/rds/rds_security_group.py | Apache-2.0 |
def check_flow_logs_enabled(self, vpc_item):
"""
alert when flow logs are not enabled for VPC
"""
if not self.account_mapping.get(vpc_item.account):
flow_log_items = self.get_watcher_support_items(FlowLog.index, vpc_item.account)
self.account_mapping[vpc_item.acc... |
alert when flow logs are not enabled for VPC
| check_flow_logs_enabled | python | Netflix/security_monkey | security_monkey/auditors/vpc/vpc.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/vpc/vpc.py | Apache-2.0 |
def check_tunnels(self, vpn_item):
"""
alert when a VPN tunnel is not UP.
"""
if vpn_item.config.get('tunnels'):
for tunnel in vpn_item.config.get('tunnels'):
if tunnel.get('status') != "UP":
notes = "{} - {} - {}".format(tunnel.get('outsid... |
alert when a VPN tunnel is not UP.
| check_tunnels | python | Netflix/security_monkey | security_monkey/auditors/vpc/vpn.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auditors/vpc/vpn.py | Apache-2.0 |
def allow(self, role, method, resource, with_children=True):
"""Add allowing rules.
:param role: Role of this rule.
:param method: Method to allow in rule, include GET, POST, PUT etc.
:param resource: Resource also view function.
:param with_children: Allow role's children in ru... | Add allowing rules.
:param role: Role of this rule.
:param method: Method to allow in rule, include GET, POST, PUT etc.
:param resource: Resource also view function.
:param with_children: Allow role's children in rule as well
if with_children is `True`
... | allow | python | Netflix/security_monkey | security_monkey/auth/modules.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auth/modules.py | Apache-2.0 |
def has_permission(self, method, endpoint, user=None):
"""Return whether the current user can access the resource.
Example::
@app.route('/some_url', methods=['GET', 'POST'])
@rbac.allow(['anonymous'], ['GET'])
def a_view_func():
return Response('Blah ... | Return whether the current user can access the resource.
Example::
@app.route('/some_url', methods=['GET', 'POST'])
@rbac.allow(['anonymous'], ['GET'])
def a_view_func():
return Response('Blah Blah...')
If you are not logged.
`rbac.has_permi... | has_permission | python | Netflix/security_monkey | security_monkey/auth/modules.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auth/modules.py | Apache-2.0 |
def allow(self, roles, methods, with_children=True):
"""Decorator: allow roles to access the view func with it.
:param roles: List, each name of roles. Please note that,
`anonymous` is refered to anonymous.
If you add `anonymous` to the rule,
... | Decorator: allow roles to access the view func with it.
:param roles: List, each name of roles. Please note that,
`anonymous` is refered to anonymous.
If you add `anonymous` to the rule,
everyone can access the resource,
un... | allow | python | Netflix/security_monkey | security_monkey/auth/modules.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auth/modules.py | Apache-2.0 |
def get_app(self, reference_app=None):
"""
Helper to look up an app.
"""
if reference_app is not None:
return reference_app
if self.app is not None:
return self.app
ctx = _app_ctx_stack.top
if ctx is not None:
return ctx.app
... |
Helper to look up an app.
| get_app | python | Netflix/security_monkey | security_monkey/auth/modules.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/auth/modules.py | Apache-2.0 |
def get_jinja_env():
"""
Returns a Jinja environment with a FileSystemLoader for our templates
"""
templates_directory = os.path.abspath(os.path.join(__file__, '..', '..', templates))
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(templates_directory), # nosec
... |
Returns a Jinja environment with a FileSystemLoader for our templates
| get_jinja_env | python | Netflix/security_monkey | security_monkey/common/jinja.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/jinja.py | Apache-2.0 |
def diff_dict(dicta, dictb, indentation):
"""
diff_dict and diff_list are recursive methods which build an HTML representation of the differences between two objects.
"""
retstr = ''
for keya in list(dicta.keys()):
if keya not in dictb:
brackets = get_brackets(dicta[keya])
... |
diff_dict and diff_list are recursive methods which build an HTML representation of the differences between two objects.
| diff_dict | python | Netflix/security_monkey | security_monkey/common/PolicyDiff.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/PolicyDiff.py | Apache-2.0 |
def diff_list(lista, listb, indentation):
"""
diff_dict and diff_list are recursive methods which build an HTML representation of the differences between two objects.
When multiple items in a list have been modified, the levenshtein distance is used to find which items most likely
were ... |
diff_dict and diff_list are recursive methods which build an HTML representation of the differences between two objects.
When multiple items in a list have been modified, the levenshtein distance is used to find which items most likely
were modified from one object to the next. Although t... | diff_list | python | Netflix/security_monkey | security_monkey/common/PolicyDiff.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/PolicyDiff.py | Apache-2.0 |
def str_distance(a, b):
"Calculates the Levenshtein distance between a and b."
n, m = len(a), len(b)
if n > m:
# Make sure n <= m, to use O(min(n,m)) space
a, b = b, a
n, m = m, n
current = list(range(n+1))
for i in range(1, m+1):
previous, current = current, [i]+[0]*... | Calculates the Levenshtein distance between a and b. | str_distance | python | Netflix/security_monkey | security_monkey/common/PolicyDiff.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/PolicyDiff.py | Apache-2.0 |
def get_canonical_ids(accounts, override=False):
"""
Given a list of AWS Account IDs, reach out to AWS to fetch the Canonical IDs
:param override:
:param accounts:
:return:
"""
if not override:
app.logger.info("[@] Override flag was not passed in -- will skip over accounts with a can... |
Given a list of AWS Account IDs, reach out to AWS to fetch the Canonical IDs
:param override:
:param accounts:
:return:
| get_canonical_ids | python | Netflix/security_monkey | security_monkey/common/s3_canonical.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/s3_canonical.py | Apache-2.0 |
def connect(account_name, connection_type, **args):
"""
Examples of use:
ec2 = sts_connect.connect(environment, 'ec2', region=region, validate_certs=False)
ec2 = sts_connect.connect(environment, 'ec2', validate_certs=False, debug=1000)
ec2 = sts_connect.connect(environment, 'ec2')
where environ... |
Examples of use:
ec2 = sts_connect.connect(environment, 'ec2', region=region, validate_certs=False)
ec2 = sts_connect.connect(environment, 'ec2', validate_certs=False, debug=1000)
ec2 = sts_connect.connect(environment, 'ec2')
where environment is ( test, prod, dev )
s3 = sts_connect.connect(e... | connect | python | Netflix/security_monkey | security_monkey/common/sts_connect.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/sts_connect.py | Apache-2.0 |
def check_rfc_1918(cidr):
"""
EC2-Classic SG's should never use RFC-1918 CIDRs
"""
if ipaddr.IPNetwork(cidr) in ipaddr.IPNetwork('10.0.0.0/8'):
return True
if ipaddr.IPNetwork(cidr) in ipaddr.IPNetwork('172.16.0.0/12'):
return True
if ipaddr.IPNe... |
EC2-Classic SG's should never use RFC-1918 CIDRs
| check_rfc_1918 | python | Netflix/security_monkey | security_monkey/common/utils.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/utils.py | Apache-2.0 |
def find_modules(folder):
"""
Used to dynamically load custom classes, loads classes under the specified
directory
"""
# Use this file's path to get the full path and module names of the module
# files to be loaded
path = os.path.realpath(__file__)
path = os.path.splitext(path)[0]
pa... |
Used to dynamically load custom classes, loads classes under the specified
directory
| find_modules | python | Netflix/security_monkey | security_monkey/common/utils.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/utils.py | Apache-2.0 |
def load_plugins(group):
"""Find and load plugins by iterating entry points."""
import pkg_resources
for entry_point in pkg_resources.iter_entry_points(group):
app.logger.debug("Loading plugin %s", entry_point.module_name)
entry_point.load() | Find and load plugins by iterating entry points. | load_plugins | python | Netflix/security_monkey | security_monkey/common/utils.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/utils.py | Apache-2.0 |
def send_email(subject=None, recipients=None, html=""):
"""
Given a message, will send that message over SES or SMTP, depending upon how the app is configured.
"""
if app.config.get("DISABLE_EMAILS"):
app.logger.warn("[?] Emails are disabled in the config. But the send_email function was still c... |
Given a message, will send that message over SES or SMTP, depending upon how the app is configured.
| send_email | python | Netflix/security_monkey | security_monkey/common/utils.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/utils.py | Apache-2.0 |
def get_gcp_project_creds(account_names):
"""
Build list of dicts with project credentials.
Takes a list of account names and fetches all of those accounts.
If the custom_field 'credentials_file' (custom field) is set, the list
item will be in the format of: {'project': 'my-project', 'key_file': 'm... |
Build list of dicts with project credentials.
Takes a list of account names and fetches all of those accounts.
If the custom_field 'credentials_file' (custom field) is set, the list
item will be in the format of: {'project': 'my-project', 'key_file': 'my-key'}
Otherwise, it will be simply the proj... | get_gcp_project_creds | python | Netflix/security_monkey | security_monkey/common/gcp/util.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/gcp/util.py | Apache-2.0 |
def get_github_creds(account_names):
"""
Grab GitHub credentials from a JSON file on disk.
The dict looks like this:
{
"Organization-Name": "API KEY",
"Organization-Name-2": "API KEY 2",
...
}
:param account_names: list of account names
:type account_names: ``list``... |
Grab GitHub credentials from a JSON file on disk.
The dict looks like this:
{
"Organization-Name": "API KEY",
"Organization-Name-2": "API KEY 2",
...
}
:param account_names: list of account names
:type account_names: ``list``
| get_github_creds | python | Netflix/security_monkey | security_monkey/common/github/util.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/github/util.py | Apache-2.0 |
def iter_org(orgs):
"""
Decorator for looping over many GitHub organizations.
This will pass in the exception map properly.
:param orgs:
:return:
"""
def decorator(func):
@wraps(func)
def decorated_function(*args, **kwargs):
item_list = []
if not kwar... |
Decorator for looping over many GitHub organizations.
This will pass in the exception map properly.
:param orgs:
:return:
| iter_org | python | Netflix/security_monkey | security_monkey/common/github/util.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/github/util.py | Apache-2.0 |
def strip_url_fields(blob):
"""
Utility function to strip out the "_url" fields returned from GitHub, since
they aren't really useful for the purposes of Security Monkey, and add in
bloat to the record.
This will recursively remove them from nested dictionaries.
:param blob:
:return:
""... |
Utility function to strip out the "_url" fields returned from GitHub, since
they aren't really useful for the purposes of Security Monkey, and add in
bloat to the record.
This will recursively remove them from nested dictionaries.
:param blob:
:return:
| strip_url_fields | python | Netflix/security_monkey | security_monkey/common/github/util.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/common/github/util.py | Apache-2.0 |
def get_rsa_public_key(n, e):
"""
Retrieve an RSA public key based on a module and exponent as provided by the JWKS format.
:param n:
:param e:
:return: a RSA Public Key in PEM format
"""
n = int(binascii.hexlify(jwt.utils.base64url_decode(bytes(n, encoding="utf-8"))), 16)
e = int(binasc... |
Retrieve an RSA public key based on a module and exponent as provided by the JWKS format.
:param n:
:param e:
:return: a RSA Public Key in PEM format
| get_rsa_public_key | python | Netflix/security_monkey | security_monkey/sso/service.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/sso/service.py | Apache-2.0 |
def fetch_token_header_payload(token):
"""
Fetch the header and payload out of the JWT token.
:param token:
:return: :raise jwt.DecodeError:
"""
token = token.encode('utf-8')
try:
signing_input, crypto_segment = token.rsplit(b'.', 1)
header_segment, payload_segment = signing_... |
Fetch the header and payload out of the JWT token.
:param token:
:return: :raise jwt.DecodeError:
| fetch_token_header_payload | python | Netflix/security_monkey | security_monkey/sso/service.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/sso/service.py | Apache-2.0 |
def on_identity_loaded(sender, identity):
"""
Sets the identity of a given option, assigns additional permissions based on
the role that the user is a part of.
:param sender:
:param identity:
"""
# load the user
user = User.query.filter(User.id==identity.id).first()
# add the UserNe... |
Sets the identity of a given option, assigns additional permissions based on
the role that the user is a part of.
:param sender:
:param identity:
| on_identity_loaded | python | Netflix/security_monkey | security_monkey/sso/service.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/sso/service.py | Apache-2.0 |
def fix_orphaned_deletions(account_name, technology_name):
"""
Possible issue with orphaned items. This will check if there are any, and will assume that the item
was deleted. This will create a deletion change record to it.
:param account_name:
:param technology_name:
:return:
"""
# If... |
Possible issue with orphaned items. This will check if there are any, and will assume that the item
was deleted. This will create a deletion change record to it.
:param account_name:
:param technology_name:
:return:
| fix_orphaned_deletions | python | Netflix/security_monkey | security_monkey/task_scheduler/tasks.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/tasks.py | Apache-2.0 |
def reporter_logic(account_name, technology_name):
"""Logic for the run change reporter"""
try:
# Before doing anything... Look for orphaned items for this given technology. If they exist, then delete them:
fix_orphaned_deletions(account_name, technology_name)
# Watch and Audit:
... | Logic for the run change reporter | reporter_logic | python | Netflix/security_monkey | security_monkey/task_scheduler/tasks.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/tasks.py | Apache-2.0 |
def manual_run_change_reporter(accounts):
"""Manual change reporting from the command line"""
app.logger.info("[ ] Executing manual change reporter task...")
try:
for account in accounts:
time1 = time.time()
rep = Reporter(account=account)
for monitor in rep.all... | Manual change reporting from the command line | manual_run_change_reporter | python | Netflix/security_monkey | security_monkey/task_scheduler/tasks.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/tasks.py | Apache-2.0 |
def find_changes(account_name, monitor_name, debug=True):
"""
Runs the watcher and stores the result, re-audits all types to account
for downstream dependencies.
"""
# Before doing anything... Look for orphaned items for this given technology. If they exist, then delete them:
fix_orphane... |
Runs the watcher and stores the result, re-audits all types to account
for downstream dependencies.
| find_changes | python | Netflix/security_monkey | security_monkey/task_scheduler/tasks.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/tasks.py | Apache-2.0 |
def audit_changes(accounts, monitor_names, send_report, debug=True, skip_batch=True, items_count=None):
"""
Audits changes in the accounts
:param accounts:
:param monitor_names:
:param send_report:
:param debug:
:param skip_batch:
:return:
"""
for account in accounts:
mon... |
Audits changes in the accounts
:param accounts:
:param monitor_names:
:param send_report:
:param debug:
:param skip_batch:
:return:
| audit_changes | python | Netflix/security_monkey | security_monkey/task_scheduler/tasks.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/tasks.py | Apache-2.0 |
def batch_logic(monitor, current_watcher, account_name, debug):
"""
Performs the batch watcher finding and auditing.
TODO: Investigate how this could, in the future, be set to parallelize the batches.
:param monitor:
:param current_watcher:
:param account_name:
:param debug:
:return:
... |
Performs the batch watcher finding and auditing.
TODO: Investigate how this could, in the future, be set to parallelize the batches.
:param monitor:
:param current_watcher:
:param account_name:
:param debug:
:return:
| batch_logic | python | Netflix/security_monkey | security_monkey/task_scheduler/tasks.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/tasks.py | Apache-2.0 |
def _audit_specific_changes(monitor, audit_items, send_report, debug=True):
"""
Runs the auditor on specific items that are passed in.
:param monitor:
:param audit_items:
:param send_report:
:param debug:
:return:
"""
try:
for au in monitor.auditors:
au.items = au... |
Runs the auditor on specific items that are passed in.
:param monitor:
:param audit_items:
:param send_report:
:param debug:
:return:
| _audit_specific_changes | python | Netflix/security_monkey | security_monkey/task_scheduler/tasks.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/tasks.py | Apache-2.0 |
def make_celery(app):
"""
Recommended from Flask's documentation to set up the Celery object.
:param app:
:return:
"""
celery = Celery(app.import_name)
# Determine which Celery configuration to load:
# The order is:
# 1. `SM_CELERY_CONFIG` Environment Variable
# 2. The default "... |
Recommended from Flask's documentation to set up the Celery object.
:param app:
:return:
| make_celery | python | Netflix/security_monkey | security_monkey/task_scheduler/util.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/util.py | Apache-2.0 |
def setup():
"""Load the required data for scheduling tasks"""
find_modules('alerters')
find_modules('watchers')
find_modules('auditors')
load_plugins('security_monkey.plugins') | Load the required data for scheduling tasks | setup | python | Netflix/security_monkey | security_monkey/task_scheduler/util.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/util.py | Apache-2.0 |
def get_sm_celery_config_value(celery_config, variable_name, variable_type):
"""
This returns a celery configuration value of a given type back.
If it's not set, it will return None.
:param variable_name: The name of the Celery configuration variable to obtain.
:param type: The type of the value, s... |
This returns a celery configuration value of a given type back.
If it's not set, it will return None.
:param variable_name: The name of the Celery configuration variable to obtain.
:param type: The type of the value, such as `list`, `dict`, etc.
:return:
| get_sm_celery_config_value | python | Netflix/security_monkey | security_monkey/task_scheduler/util.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/task_scheduler/util.py | Apache-2.0 |
def build_mock_result(watcher_configs, auditor_configs):
"""
Builds mock monitor results that can be used to override the results of the
monitor methods.
"""
del CURRENT_MONITORS[:]
for config in watcher_configs:
watcher = mock_watcher(config)
auditors = []
for config ... |
Builds mock monitor results that can be used to override the results of the
monitor methods.
| build_mock_result | python | Netflix/security_monkey | security_monkey/tests/core/monitor_mock.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/monitor_mock.py | Apache-2.0 |
def test_issue_presevation(self):
"""
Ensure that issues are not deleted and that justifications are preserved.
new issue
existing issue
fixed issue
regressed issue
Context: PR 788
"""
auditor = AuditorTestObj(accounts=['test_accoun... |
Ensure that issues are not deleted and that justifications are preserved.
new issue
existing issue
fixed issue
regressed issue
Context: PR 788
| test_issue_presevation | python | Netflix/security_monkey | security_monkey/tests/core/test_auditor.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/test_auditor.py | Apache-2.0 |
def test_doesnt_delete_parent_cascade(self):
"""
If the exception is deleted, the parent (tech., item, account) should not be deleted.
:return:
"""
try:
raise ValueError("This is a test")
except ValueError as e:
test_exception = e
location... |
If the exception is deleted, the parent (tech., item, account) should not be deleted.
:return:
| test_doesnt_delete_parent_cascade | python | Netflix/security_monkey | security_monkey/tests/core/test_exception_logging.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/test_exception_logging.py | Apache-2.0 |
def test_child_deletion_cascade_check(self):
"""
If the exception object is deleted, then the parent object (items, account, tech.) should NOT be deleted.
:return:
"""
try:
raise ValueError("This is a test")
except ValueError as e:
test_exception =... |
If the exception object is deleted, then the parent object (items, account, tech.) should NOT be deleted.
:return:
| test_child_deletion_cascade_check | python | Netflix/security_monkey | security_monkey/tests/core/test_exception_logging.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/test_exception_logging.py | Apache-2.0 |
def test_safe_child_deletion_cascade(self):
"""
If the parent is deleted (item, account, tech.), the exception should be deleted, BUT the other parents
should remain.
:return:
"""
try:
raise ValueError("This is a test")
except ValueError as e:
... |
If the parent is deleted (item, account, tech.), the exception should be deleted, BUT the other parents
should remain.
:return:
| test_safe_child_deletion_cascade | python | Netflix/security_monkey | security_monkey/tests/core/test_exception_logging.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/test_exception_logging.py | Apache-2.0 |
def test_find_changes_batch(self):
"""
This will test the entry point via the find_changes() method vs. the find_changes_batch() method.
This will also use the IAMRole watcher, since that already has batching support.
:return:
"""
from security_monkey.watchers.iam.iam_ro... |
This will test the entry point via the find_changes() method vs. the find_changes_batch() method.
This will also use the IAMRole watcher, since that already has batching support.
:return:
| test_find_changes_batch | python | Netflix/security_monkey | security_monkey/tests/core/test_watcher.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/test_watcher.py | Apache-2.0 |
def test_find_deleted_batch(self):
"""
This will use the IAMRole watcher, since that already has batching support.
:return:
"""
from security_monkey.watchers.iam.iam_role import IAMRole
self.setup_batch_db()
# Set everything up:
watcher = IAMRole(account... |
This will use the IAMRole watcher, since that already has batching support.
:return:
| test_find_deleted_batch | python | Netflix/security_monkey | security_monkey/tests/core/test_watcher.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/test_watcher.py | Apache-2.0 |
def test_ensure_item_has_latest_revision_id(self):
"""
Test that items always have a proper current revision set. Otherwise, the item needs to be deleted.
:return:
"""
from security_monkey.watchers.iam.iam_role import IAMRole
from security_monkey.watcher import ensure_it... |
Test that items always have a proper current revision set. Otherwise, the item needs to be deleted.
:return:
| test_ensure_item_has_latest_revision_id | python | Netflix/security_monkey | security_monkey/tests/core/test_watcher.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/core/test_watcher.py | Apache-2.0 |
def test_find_batch_changes(self, mock_fix_orphaned):
"""
Runs through a full find job via the IAMRole watcher, as that supports batching.
However, this is mostly testing the logic through each function call -- this is
not going to do any boto work and that will instead be mocked out.
... |
Runs through a full find job via the IAMRole watcher, as that supports batching.
However, this is mostly testing the logic through each function call -- this is
not going to do any boto work and that will instead be mocked out.
:return:
| test_find_batch_changes | python | Netflix/security_monkey | security_monkey/tests/scheduling/test_celery_scheduler.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/scheduling/test_celery_scheduler.py | Apache-2.0 |
def test_successful_authenticatoin_redirects(self, mock_login, mock_jwt_decode, mock_header_payload, mock_get_jwks, mock_redirect_validation, mock_fetch_token, mock_parse_args):
"""Test that given the Okta tokens are valid and the flow completes, it returns a 302 to the return to"""
mock_parse_args.retu... | Test that given the Okta tokens are valid and the flow completes, it returns a 302 to the return to | test_successful_authenticatoin_redirects | python | Netflix/security_monkey | security_monkey/tests/sso/test_okta.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/sso/test_okta.py | Apache-2.0 |
def test_okta_invalid_id_token_expired(self, mock_header_payload, mock_get_jwks, mock_redirect_validation, mock_fetch_token, mock_parse_args):
"""Test that given an expired token, the expected error is returned."""
mock_parse_args.return_value = VALID_OKTA_AUTH_RESPONSE
mock_fetch_token.return_v... | Test that given an expired token, the expected error is returned. | test_okta_invalid_id_token_expired | python | Netflix/security_monkey | security_monkey/tests/sso/test_okta.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/sso/test_okta.py | Apache-2.0 |
def test_okta_bad_secret_causes_invalid_id_token_decode_error(self, mock_header_payload, mock_get_jwks, mock_redirect_validation, mock_fetch_token, mock_parse_args):
"""Test that given a bad decode the expected error is returned (causing this by having a garbage token."""
mock_parse_args.return_value = ... | Test that given a bad decode the expected error is returned (causing this by having a garbage token. | test_okta_bad_secret_causes_invalid_id_token_decode_error | python | Netflix/security_monkey | security_monkey/tests/sso/test_okta.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/sso/test_okta.py | Apache-2.0 |
def test_slurp(self):
"""
Tests whether the watcher finds the three created buckets.
:return:
"""
mock_sts().start()
s3_watcher = S3(accounts=[self.account.name])
item_list, exception_map = s3_watcher.slurp()
assert len(item_list) == 3 # We created 3 b... |
Tests whether the watcher finds the three created buckets.
:return:
| test_slurp | python | Netflix/security_monkey | security_monkey/tests/watchers/test_s3.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/tests/watchers/test_s3.py | Apache-2.0 |
def get(self, account_id):
"""
.. http:get:: /api/1/account/<int:id>
Get a list of Accounts matching the given criteria
**Example Request**:
.. sourcecode:: http
GET /api/1/account/1 HTTP/1.1
Host: example.com
Ac... |
.. http:get:: /api/1/account/<int:id>
Get a list of Accounts matching the given criteria
**Example Request**:
.. sourcecode:: http
GET /api/1/account/1 HTTP/1.1
Host: example.com
Accept: application/json, text/javascrip... | get | python | Netflix/security_monkey | security_monkey/views/account.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account.py | Apache-2.0 |
def put(self, account_id):
"""
.. http:put:: /api/1/account/1
Edit an existing account.
**Example Request**:
.. sourcecode:: http
PUT /api/1/account/1 HTTP/1.1
Host: example.com
Accept: application/json
... |
.. http:put:: /api/1/account/1
Edit an existing account.
**Example Request**:
.. sourcecode:: http
PUT /api/1/account/1 HTTP/1.1
Host: example.com
Accept: application/json
{
'name': ... | put | python | Netflix/security_monkey | security_monkey/views/account.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account.py | Apache-2.0 |
def delete(self, account_id):
"""
.. http:delete:: /api/1/account/1
Delete an account.
**Example Request**:
.. sourcecode:: http
DELETE /api/1/account/1 HTTP/1.1
Host: example.com
Accept: application/json
... |
.. http:delete:: /api/1/account/1
Delete an account.
**Example Request**:
.. sourcecode:: http
DELETE /api/1/account/1 HTTP/1.1
Host: example.com
Accept: application/json
**Example Response**:
... | delete | python | Netflix/security_monkey | security_monkey/views/account.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account.py | Apache-2.0 |
def post(self):
"""
.. http:post:: /api/1/account/
Create a new account.
**Example Request**:
.. sourcecode:: http
POST /api/1/account/ HTTP/1.1
Host: example.com
Accept: application/json
{
... |
.. http:post:: /api/1/account/
Create a new account.
**Example Request**:
.. sourcecode:: http
POST /api/1/account/ HTTP/1.1
Host: example.com
Accept: application/json
{
'name': 'new... | post | python | Netflix/security_monkey | security_monkey/views/account.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account.py | Apache-2.0 |
def get(self):
"""
.. http:get:: /api/1/accounts
Get a list of Accounts matching the given criteria
**Example Request**:
.. sourcecode:: http
GET /api/1/accounts HTTP/1.1
Host: example.com
Accept: application/jso... |
.. http:get:: /api/1/accounts
Get a list of Accounts matching the given criteria
**Example Request**:
.. sourcecode:: http
GET /api/1/accounts HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
... | get | python | Netflix/security_monkey | security_monkey/views/account.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account.py | Apache-2.0 |
def get(self, account_fields):
"""
.. http:get:: /api/1/account_config/account_fields (all or custom)
Get a list of Account types
**Example Request**:
.. sourcecode:: http
GET /api/1/account_config/all HTTP/1.1
Host: example.com... |
.. http:get:: /api/1/account_config/account_fields (all or custom)
Get a list of Account types
**Example Request**:
.. sourcecode:: http
GET /api/1/account_config/all HTTP/1.1
Host: example.com
Accept: application/json,... | get | python | Netflix/security_monkey | security_monkey/views/account_config.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account_config.py | Apache-2.0 |
def get(self, auditscores_id):
"""
.. http:get:: /api/1/auditscores/<int:auditscores_id>/accountpatternauditscores
Get a list of override scores for account pattern audit scores.
**Example Request**:
.. sourcecode:: http
GET /api/1/auditscores/... |
.. http:get:: /api/1/auditscores/<int:auditscores_id>/accountpatternauditscores
Get a list of override scores for account pattern audit scores.
**Example Request**:
.. sourcecode:: http
GET /api/1/auditscores/123/accountpatternauditscores HTTP/1.1
... | get | python | Netflix/security_monkey | security_monkey/views/account_pattern_audit_score.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account_pattern_audit_score.py | Apache-2.0 |
def post(self):
"""
.. http:post:: /api/1/accountpatternauditscores
Create a new override account pattern audit score.
**Example Request**:
.. sourcecode:: http
POST /api/1/accountpatternauditscores HTTP/1.1
Host: example.com
... |
.. http:post:: /api/1/accountpatternauditscores
Create a new override account pattern audit score.
**Example Request**:
.. sourcecode:: http
POST /api/1/accountpatternauditscores HTTP/1.1
Host: example.com
Accept: appli... | post | python | Netflix/security_monkey | security_monkey/views/account_pattern_audit_score.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account_pattern_audit_score.py | Apache-2.0 |
def get(self, id):
"""
.. http:get:: /api/1/accountpatternauditscores/<int:id>
Get the overide account pattern audit score with given ID.
**Example Request**:
.. sourcecode:: http
GET /api/1/accountpatternauditscores/234 HTTP/1.1
... |
.. http:get:: /api/1/accountpatternauditscores/<int:id>
Get the overide account pattern audit score with given ID.
**Example Request**:
.. sourcecode:: http
GET /api/1/accountpatternauditscores/234 HTTP/1.1
Host: example.com
... | get | python | Netflix/security_monkey | security_monkey/views/account_pattern_audit_score.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account_pattern_audit_score.py | Apache-2.0 |
def put(self, id):
"""
.. http:put:: /api/1/accountpatternauditscores/<int:id>
Update override account pattern audit score with the given ID.
**Example Request**:
.. sourcecode:: http
PUT /api/1/accountpatternauditscores/234 HTTP/1.1
... |
.. http:put:: /api/1/accountpatternauditscores/<int:id>
Update override account pattern audit score with the given ID.
**Example Request**:
.. sourcecode:: http
PUT /api/1/accountpatternauditscores/234 HTTP/1.1
Host: example.com
... | put | python | Netflix/security_monkey | security_monkey/views/account_pattern_audit_score.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account_pattern_audit_score.py | Apache-2.0 |
def delete(self, id):
"""
.. http:delete:: /api/1/accountpatternauditscores/<int:id>
Delete an override account pattern audit score
**Example Request**:
.. sourcecode:: http
DELETE /api/1/accountpatternauditscores/234 HTTP/1.1
H... |
.. http:delete:: /api/1/accountpatternauditscores/<int:id>
Delete an override account pattern audit score
**Example Request**:
.. sourcecode:: http
DELETE /api/1/accountpatternauditscores/234 HTTP/1.1
Host: example.com
... | delete | python | Netflix/security_monkey | security_monkey/views/account_pattern_audit_score.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/account_pattern_audit_score.py | Apache-2.0 |
def get(self):
"""
.. http:get:: /api/1/auditorsettings
Get a list of AuditorSetting items
**Example Request**:
.. sourcecode:: http
GET /api/1/auditorsettings HTTP/1.1
Host: example.com
Accept: application/json,... |
.. http:get:: /api/1/auditorsettings
Get a list of AuditorSetting items
**Example Request**:
.. sourcecode:: http
GET /api/1/auditorsettings HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
... | get | python | Netflix/security_monkey | security_monkey/views/auditor_settings.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/auditor_settings.py | Apache-2.0 |
def put(self, as_id):
"""
.. http:put:: /api/1/auditorsettings/<int ID>
Update an AuditorSetting
**Example Request**:
.. sourcecode:: http
PUT /api/1/auditorsettings/1 HTTP/1.1
Host: example.com
Accept: applicati... |
.. http:put:: /api/1/auditorsettings/<int ID>
Update an AuditorSetting
**Example Request**:
.. sourcecode:: http
PUT /api/1/auditorsettings/1 HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
... | put | python | Netflix/security_monkey | security_monkey/views/auditor_settings.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/auditor_settings.py | Apache-2.0 |
def get(self):
"""
.. http:get:: /api/1/auditscores
Get a list of override scores for audit items.
**Example Request**:
.. sourcecode:: http
GET /api/1/auditscores HTTP/1.1
Host: example.com
Accept: application/j... |
.. http:get:: /api/1/auditscores
Get a list of override scores for audit items.
**Example Request**:
.. sourcecode:: http
GET /api/1/auditscores HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
... | get | python | Netflix/security_monkey | security_monkey/views/audit_scores.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/audit_scores.py | Apache-2.0 |
def post(self):
"""
.. http:post:: /api/1/auditscores
Create a new override audit score.
**Example Request**:
.. sourcecode:: http
POST /api/1/auditscores HTTP/1.1
Host: example.com
Accept: application/json
... |
.. http:post:: /api/1/auditscores
Create a new override audit score.
**Example Request**:
.. sourcecode:: http
POST /api/1/auditscores HTTP/1.1
Host: example.com
Accept: application/json
{
... | post | python | Netflix/security_monkey | security_monkey/views/audit_scores.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/audit_scores.py | Apache-2.0 |
def get(self, id):
"""
.. http:get:: /api/1/auditscores/<int:id>
Get the overide audit score with given ID.
**Example Request**:
.. sourcecode:: http
GET /api/1/auditscores/123 HTTP/1.1
Host: example.com
Accept: ... |
.. http:get:: /api/1/auditscores/<int:id>
Get the overide audit score with given ID.
**Example Request**:
.. sourcecode:: http
GET /api/1/auditscores/123 HTTP/1.1
Host: example.com
Accept: application/json, text/javascr... | get | python | Netflix/security_monkey | security_monkey/views/audit_scores.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/audit_scores.py | Apache-2.0 |
def put(self, id):
"""
.. http:get:: /api/1/auditscores/<int:id>
Update override audit score with the given ID.
**Example Request**:
.. sourcecode:: http
PUT /api/1/auditscores/123 HTTP/1.1
Host: example.com
Acce... |
.. http:get:: /api/1/auditscores/<int:id>
Update override audit score with the given ID.
**Example Request**:
.. sourcecode:: http
PUT /api/1/auditscores/123 HTTP/1.1
Host: example.com
Accept: application/json, text/jav... | put | python | Netflix/security_monkey | security_monkey/views/audit_scores.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/audit_scores.py | Apache-2.0 |
def delete(self, id):
"""
.. http:delete:: /api/1/auditscores/123
Delete an override audit score
**Example Request**:
.. sourcecode:: http
DELETE /api/1/auditscores/123 HTTP/1.1
Host: example.com
Accept: applicat... |
.. http:delete:: /api/1/auditscores/123
Delete an override audit score
**Example Request**:
.. sourcecode:: http
DELETE /api/1/auditscores/123 HTTP/1.1
Host: example.com
Accept: application/json
**Example R... | delete | python | Netflix/security_monkey | security_monkey/views/audit_scores.py | https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/audit_scores.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.