How to use the policyuniverse.score_policy function in policyuniverse

To help you get started, we’ve selected a few policyuniverse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Netflix-Skunkworks / policyuniverse / tests / TestMethods.py View on Github external
"Action": [
                    "sqs:SetQueueAttributes",
                    "sqs:AddPermission"
                    ],
                "Resource": "*",
                "Effect": "Allow"
            },{
                "Action": [
                    "sns:SetTopicAttributes",
                    "sns:AddPermission"
                    ],
                "Resource": "*",
                "Effect": "Allow"
            }]
        }
        score, service_tags, service_score = score_policy(policy)
        self.assertEqual(service_tags['iam'], {'CONTROL_PLANE', 'MUTATING'})
        self.assertEqual(service_score['iam'], 7)
        self.assertEqual(service_tags['s3'], {'CONTROL_PLANE', 'MUTATING'})
        self.assertEqual(service_score['s3'], 7)
        self.assertEqual(service_tags['sqs'], {'CONTROL_PLANE', 'MUTATING'})
        self.assertEqual(service_score['sqs'], 7)
        self.assertEqual(service_tags['sns'], {'CONTROL_PLANE', 'MUTATING'})
        self.assertEqual(service_score['sns'], 7)
        self.assertEqual(score, 47)
github Netflix-Skunkworks / policyuniverse / tests / TestMethods.py View on Github external
"Effect": "Allow"
            },{
                "Action": [
                    "sns:Publish"
                    ],
                "Resource": "*",
                "Effect": "Allow"
            },{
                "Action": [
                    "iam:ListRoles",
                    ],
                "Resource": "*",
                "Effect": "Allow"
            }]
        }
        score, service_tags, service_score = score_policy(policy)
        self.assertEqual(service_tags['s3'], {'DATA_PLANE', 'MUTATING'})
        self.assertEqual(service_score['s3'], 6)
        self.assertEqual(service_tags['sqs'], {'DATA_PLANE', 'SIDE_EFFECT'})
        self.assertEqual(service_score['sqs'], 5)
        self.assertEqual(service_tags['sns'], {'DATA_PLANE', 'SIDE_EFFECT'})
        self.assertEqual(service_score['sns'], 5)
        self.assertEqual(service_tags['iam'], {'READ'})
        self.assertEqual(service_score['iam'], 1)
        self.assertEqual(score, 23)