Skip to main content

parliament audits your AWS IAM policies

Project description

parliament is an AWS IAM linting library. It reviews policies looking for problems such as:

  • malformed json
  • missing required elements
  • incorrect prefix and action names
  • incorrect resources or conditions for the actions provided
  • type mismatches
  • bad policy patterns

This library duplicates (and adds to!) much of the functionality in the web console page when reviewing IAM policies in the browser. We wanted that functionality as a library.

The IAM data is obtained from scraping the docs here and parsing this information with beautifulsoup using ./utils/update_iam_data.py.

Installation

pip install parliament

Usage

$ parliament --string '{"Version":"2012-10-17","Statement": {"Effect": "Allow","Action":["s3:GetObject"],"Resource": ["arn:aws:s3:::bucket1"]}}'
INVALID - No resources match for s3:GetObject which requires a resource format of arn:*:s3:::*/* for the resource object* - {'filepath': None}

This example is showing that a resource specifying an S3 bucket (not an object path) was given in a policy with s3:GetObject, which requires an object path.

See ./bin/parliament.py for further examples.

Development

Setup a testing environment

python3 -m venv ./venv && source venv/bin/activate
pip install boto3 jmespath pyyaml nose coverage

Run unit tests with:

./tests/scripts/unit_tests.sh

Run locally as:

bin/parliament

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parliament-0.3.4.tar.gz (238.7 kB view details)

Uploaded Source

File details

Details for the file parliament-0.3.4.tar.gz.

File metadata

  • Download URL: parliament-0.3.4.tar.gz
  • Upload date:
  • Size: 238.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.0

File hashes

Hashes for parliament-0.3.4.tar.gz
Algorithm Hash digest
SHA256 508bc8c2e705b0f7518dc2afaf2c62c94315505c88457deb9d5ef1e747dd4230
MD5 6d08a27af7913508fccb190affe25fe0
BLAKE2b-256 efa2e5183bf5c1d094ac458457d55ce74b58a5fff97bb52e6f68855fbda62eae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page