Registry / aws / py-iam-expand

py-iam-expand

JSON →
library0.3.0pypypiunverified

A Python package to expand and deobfuscate AWS IAM policies. Resolves wildcards (*, ?) into the full set of matching IAM actions, can invert action sets, and handles obfuscated policies. Currently at v0.3.0, supporting Python 3.10 through 3.14. Release cadence is irregular.

pip install py-iam-expand
INSTALL
IMPORT
SIG · PY-IAM-EXPAND
P
py-iam-expand
awspythonv0.3.0
Install
2.0s avg
Import
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · 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 0.000s · 31.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.0s · import 0.000s · 32MB
30MB installed
● package 30MB
Code
Verified usage

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

expand_policy
from py_iam_expand import expand_policy
from iam_expand import expand_policy

Expand IAM policy JSON containing wildcards into the full set of actions.

from iam_expand import expand_policy policy_json = '{"Effect":"Allow","Action":["ec2:*","s3:Get*"]}' expanded = expand_policy(policy_json) print(expanded)
iam-expand --version
Debug
Known issues
gotchaThe library depends on botocore (via py-aws-actions). If you are offline or have a stale botocore cache, expansion may fail or return incomplete results. Ensure network access or a recent action cache.
fix
Run your script with internet access or pre-populate botocore's action data.
affects: <=0.3.0
breakingIn v0.1.0, the function `expand_policy` was named `expand_policies` (plural). The import path changed from `iam_expand_expand_policies` to `iam_expand.expand_policy`.
fix
Update imports to `from iam_expand import expand_policy`.
affects: 0.1.0
gotchaNon-valid actions (e.g., misspelled actions like `ec2:Describ`) can cause errors. By default, the library fails. You can change behaviour via `non_valid_action_behavior` parameter.
fix
Use `expand_policy(policy_str, non_valid_action_behavior='keep')` or `'remove'` to avoid failures.
affects: >=0.1.0
Upgrade
Version history
0.3.0latest on PyPI · released Feb 24, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
py-iam-expand — pip install py-iam-expand · libregistry