Giter Club home page Giter Club logo

policyglass's Introduction

PolicyGlass

image

PolicyGlass allows you to analyse one or more AWS policies' effective permissions in aggregate, by restating them in the form of PolicyShards which are always Allow, never Deny.

PolicyGlass will always result in only allow PolicyShard objects, no matter how complex the policy. This makes understanding the effect of your policies programmatically a breeze.

Try it out

PolicyGlass Sandbox screenshot

Try out custom policies quickly without installing anything with the PolicyGlass Sandbox.

Installation

Usage

Let's take two policies, a and b and pit them against each other.

>>> from policyglass import Policy, policy_shards_effect >>> policy_a = Policy({ ... "Version": "2012-10-17", ... "Statement": [ ... { ... "Effect": "Allow", ... "Action": [ ... "s3:*" ... ], ... "Resource": "*" ... } ... ] ... }) >>> policy_b = Policy({ ... "Version": "2012-10-17", ... "Statement": [ ... { ... "Effect": "Deny", ... "Action": [ ... "s3:" ... ], ... "Resource": "arn:aws:s3:::examplebucket/" ... } ... ] ... }) >>> policy_shards = [policy_a.policy_shards,policy_b.policy_shards] >>> effect = policy_shards_effect(policy_shards) >>> effect [PolicyShard(effect='Allow', effective_action=EffectiveAction(inclusion=Action('s3:'), exclusions=frozenset()), effective_resource=EffectiveResource(inclusion=Resource(''), exclusions=frozenset({Resource('arn:aws:s3:::examplebucket/')})), effective_principal=EffectivePrincipal(inclusion=Principal(type='AWS', value=''), exclusions=frozenset()), effective_condition=EffectiveCondition(inclusions=frozenset(), exclusions=frozenset()))]

Two policies, two statements, resulting in a single allow PolicyShard. More complex policies will result in multiple shards, but they will always be allows, no matter how complex the policy.

You can also make them human readable!

>>> from policyglass import explain_policy_shards >>> explain_policy_shards(effect) ['Allow action s3:* on resource * (except for arn:aws:s3:::examplebucket/) with principal AWS.']

policyglass's People

Contributors

sam-martin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

policyglass's Issues

Policyshard `combine` does not take conditions into account well

See

tests/unit/difference/test_policyshard.py::deny_action_and_resource_subsets
tests/unit/difference/test_policyshard.py::exact_match_on_inclusion_with_exclusion_and_condition
tests/unit/test_policy_shards_effect.py::complex_exception

for an example.

it is technically correct and doesn't state something is denied that's not, but simply provides a slightly confusing result because it shows the condition as being larger than it is even though there's another allow that covers some of the same ARP area.

UX deployment Feature

Really like the approach with PolicyGlass, but was wondering if there was a method to deploy a local sandbox capability. This way usage of policyglass is private. Not inferring that nefarious things are being done with inputs provided to the current sandbox.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.