Registry / aws / cloudsplaining

cloudsplaining

JSON →
library0.9.1pypypi✓ verified 25d ago

Cloudsplaining is an AWS IAM Security Assessment tool that identifies violations of least privilege in AWS IAM policies. It scans all policies in an AWS account or a single policy file and generates a risk-prioritized HTML report and a triage worksheet. The library is currently at version 0.8.2 and maintains an active release cadence with frequent updates and bug fixes.

pip install cloudsplaining
INSTALL
IMPORT
SIG · CLOUDSPLAINING
C
cloudsplaining
awspythonv0.9.1
Install
6.0s avg
Import
1489ms
Disk
87MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.498s · 89.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 6.0s · import 1.480s · 91MB
87MB installed
● package 87MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

scan_account_authorization_details
from cloudsplaining.command.scan import scan_account_authorization_details

This quickstart demonstrates how to programmatically scan AWS IAM authorization details using Cloudsplaining. It assumes an `account_authorization_details.json` file, which is typically generated by running `cloudsplaining download` via the CLI. The example creates a dummy JSON file for demonstration purposes. It then uses the `scan_account_authorization_details` function to generate an HTML report string.

import os import json from cloudsplaining.command.scan import scan_account_authorization_details from cloudsplaining.shared.exclusions import DEFAULT_EXCLUSIONS, Exclusions # NOTE: For a real scan, you would first generate an account authorization details JSON file. # This typically requires AWS credentials configured (e.g., via AWS CLI or environment variables) # and the `iam:GetAccountAuthorizationDetails` permission. # Example CLI command: `cloudsplaining download --output-file account_authorization_details.json` # For this example, we'll use a dummy file path and content. dummy_auth_details_path = "account_authorization_details.json" # In a real scenario, this would be a large JSON file downloaded from AWS. # Example: https://github.com/salesforce/cloudsplaining/blob/master/examples/files/iam-results-example.json dummy_auth_details_content = { "UserDetailList": [], "GroupDetailList": [], "RoleDetailList": [ { "Path": "/", "RoleName": "TestRoleWithFullS3", "RoleId": "AROAJEXAMPLEAAAEK", "Arn": "arn:aws:iam::123456789012:role/TestRoleWithFullS3", "CreateDate": "2023-01-01T00:00:00Z", "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": {"Service": "ec2.amazonaws.com"}, "Action": "sts:AssumeRole" } ] }, "AttachedManagedPolicies": [ { "PolicyName": "AmazonS3FullAccess", "PolicyArn": "arn:aws:iam::aws:policy/AmazonS3FullAccess" } ], "InstanceProfileList": [] } ], "ManagedPolicyDetailList": [], "ContextKeyDetailList": [] } with open(dummy_auth_details_path, "w") as f: json.dump(dummy_auth_details_content, f) # Create an empty exclusions object for this quickstart (you might load from a file) # An exclusions file is recommended for production use to filter out false positives. exclusions = Exclusions(DEFAULT_EXCLUSIONS) # Scan the account authorization details file programmatically try: print(f"Scanning {dummy_auth_details_path}...") html_report_string = scan_account_authorization_details( input_file=dummy_auth_details_path, exclusions=exclusions, flag_all_risky_actions=False, # Set to True to flag all risky actions regardless of resource constraints # You can also set other parameters like 'high_priority_only' or 'severity' ) # The HTML report content is returned as a string. # In a real application, you might save this to a file or serve it. # For this example, we'll just print a snippet. print("Scan complete. HTML report (snippet):\n") print(html_report_string[:500] + "...") # Clean up dummy file os.remove(dummy_auth_details_path) except Exception as e: print(f"An error occurred during scan: {e}") if os.path.exists(dummy_auth_details_path): os.remove(dummy_auth_details_path)
cloudsplaining --version
Debug
Known issues
breakingVersion 0.8.0 dropped support for Python 3.8. Users on Python 3.8 must upgrade their Python environment to 3.9 or higher to use Cloudsplaining 0.8.0 and above.
fix
Upgrade Python to version 3.9 or newer.
affects: >=0.8.0
gotchaCloudsplaining requires AWS credentials configured in the environment (e.g., via AWS CLI, environment variables like `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`) and the IAM permission `iam:GetAccountAuthorizationDetails` to download account details. Without these, the `cloudsplaining download` command will fail.
fix
Ensure AWS credentials are configured and the principal has `iam:GetAccountAuthorizationDetails` permission, typically part of the `SecurityAudit` AWS managed policy. Refer to AWS CLI documentation for credential configuration.
affects: All
gotchaCloudsplaining can generate false positives, as it does not inherently understand the context of all IAM policies in your environment (e.g., intended broad permissions for specific automation roles). It is recommended to create and utilize an 'exclusions file' to filter out these known false positives.
fix
Generate an exclusions file using `cloudsplaining create-exclusions-file` and customize it to suit your environment. Then, include it in your scan command: `cloudsplaining scan --exclusions-file exclusions.yml ...` or pass an `Exclusions` object when using the library programmatically.
affects: All
gotchaThe `--flag-all-risky-actions` (or `flag_all_risky_actions=True` in the library) option changes how Cloudsplaining identifies risky actions. By default, it considers resource constraints or conditions. When this flag is enabled, it will flag all risky actions regardless of whether resource ARN constraints or conditions are used, leading to more verbose output.
fix
Understand the implications of `--flag-all-risky-actions`. Use it when you want to see all potential risks without filtering by existing resource constraints, but be prepared for a larger number of findings that may require more aggressive triage.
affects: >=0.5.0
Errors
Common errors & fixes
command not found: cloudsplaining
The `cloudsplaining` executable is not in your system's PATH environment variable, often occurring when installed via `pip3 install --user cloudsplaining` which places executables in a user-specific binary directory not always included in PATH by default.
fix
Add the Python user base binary directory to your PATH. On macOS/Linux, this is typically `~/.local/bin`. For example, add `export PATH="$HOME/.local/bin:$PATH"` to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`) and then restart your terminal or `source` the file.
ModuleNotFoundError: No module named 'policy_sentry.analysis.expand'
This error indicates that a dependency required by cloudsplaining, specifically `policy_sentry`, is either not installed, an incorrect version, or not accessible in your Python environment. This specific issue was a known bug in older versions of Cloudsplaining that has since been fixed.
fix
Upgrade cloudsplaining to the latest version by running `pip3 install --upgrade cloudsplaining`. If the issue persists, ensure `policy_sentry` is also up-to-date or installed: `pip3 install --upgrade policy_sentry`.
An error occurred (AccessDeniedException) when calling the GetAccountAuthorizationDetails operation: User: arn:aws:iam::123456789012:user/YourUser is not authorized to perform: iam:GetAccountAuthorizationDetails on resource: arn:aws:iam::123456789012:user/YourUser
The AWS credentials configured for running cloudsplaining lack the necessary IAM permissions (`iam:GetAccountAuthorizationDetails`) to retrieve the account's IAM authorization details, which is a prerequisite for scanning.
fix
Ensure the IAM user or role configured in your AWS credentials (e.g., via `~/.aws/credentials` or environment variables) has the `iam:GetAccountAuthorizationDetails` permission. For cross-account scanning, the scanning user also needs `sts:AssumeRole` permissions for the target roles.
Upgrade
Version history
0.9.1latest on PyPI · released Jun 14, 2026
Audit
Dependencies
policy_sentryoptionalCloudsplaining is an assessment tool, while Policy Sentry is a preventative tool for policy authoring and automation. They are complementary, and Policy Sentry is often recommended for remediating issues discovered by Cloudsplaining.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources