py-iam-expand
This is a Python package to expand and deobfuscate IAM policies.
What it is and what it does
py-iam-expand is a command-line and library tool for analyzing AWS IAM policies by expanding wildcard patterns in action statements. It resolves patterns like `s3:Get*` or `ec2:Describe*` into their full list of concrete IAM actions, and can invert patterns to find actions that do not match specified criteria. The tool also removes obfuscation characters from policies and handles invalid actions according to your preference (raise error, remove silently, or keep them).
The package wraps the iamdata library to access authoritative AWS IAM action definitions. It works both as a CLI tool (reading action patterns or JSON policy documents from arguments or stdin) and as a Python library for programmatic use. It's designed to help security teams and developers understand what permissions a policy actually grants when wildcards or obfuscation are involved.
Use it for:
- Audit IAM policies to see the full set of S3, EC2, or other service actions granted by wildcard patterns.
- Invert action patterns to identify which actions are explicitly excluded by a NotAction statement.
- Process JSON IAM policy documents to expand all wildcards and produce a fully resolved policy for compliance review.
- Detect obfuscated or malformed IAM actions in policies and decide whether to flag, remove, or keep them.
- Integrate policy analysis into CI/CD pipelines to validate that IAM policies grant only intended permissions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Expands and deobfuscates AWS IAM action patterns, resolving wildcards and inverting action sets to reveal the concrete permissions they represent.
Yes. The package solves a real problem in AWS security analysis with low install friction, active maintenance, permissive licensing, and no known vulnerabilities. It's most valuable if you regularly audit IAM policies or need to understand what permissions wildcards actually grant; less critical if you only work with fully enumerated actions.
Install
py-iam-expand on PyPI
pip
pip install py-iam-expanduv
uv add py-iam-expandpoetry
poetry add py-iam-expandInstalling py-iam-expand
Before you install
Low friction install with a single runtime dependency (iamdata). Active maintenance with a recent release (2026-02-24) and ongoing commits; last commit 2026-06-19.
License in practice
Apache-2.0 permissive license allows use in commercial and open-source projects with minimal restrictions; you must include a copy of the license and state material changes.
Quickstart
pip install py-iam-expand
from py_iam_expand import expand_actions
expanded = expand_actions(['s3:Get*'])
print(expanded)
Requires Python >3.9.1 and <3.15; depends on iamdata package for AWS IAM action definitions.
Verify before relying
- Whether the iamdata dependency is kept current with AWS IAM service updates and how often it refreshes
- Performance characteristics when expanding large policy documents or complex wildcard patterns
- Whether the CLI handles all valid IAM action formats and edge cases in real-world policies
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<3.15,>3.9.1) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — iamdata |
| Maintenance | actively maintained — 171 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 118,609/month — #12,112 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py_iam_expand-0.3.0-py3-none-any.whl
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
policyuniverseParses and analyzes AWS IAM and Resource…
permissive · top 15,000 on PyPI
cloudsplainingCloudsplaining scans AWS IAM policies to…
permissive · top 5,000 on PyPI
iamdataProvides programmatic access to AWS IAM service…
permissive · top 15,000 on PyPI
policy-sentryPolicy Sentry generates least-privilege AWS IAM…
permissive · top 5,000 on PyPI
aws-cdk.aws-iamProvides Python constructs for defining AWS IAM…
permissive · top 15,000 on PyPI
awacsawacs generates AWS IAM policy JSON from Python…
permissive · top 15,000 on PyPI
drf-access-policyDeclares access control rules for Django REST…
permissive · top 15,000 on PyPI
uri-templateExpands RFC 6570 URI Templates with variable…
permissive · top 1,000 on PyPI
cloudsec-auditAudits AWS cloud security posture by checking…
permissive · top 15,000 on PyPI
parameter-expansion-patchedExpands POSIX and Bash shell parameter syntax…
permissive · top 15,000 on PyPI