Skip to content

Commit e051524

Browse files
committed
😄 working package
1 parent 50b0fa2 commit e051524

File tree

4 files changed

+56
-19
lines changed

4 files changed

+56
-19
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ __pycache__/
1515
.DS_Store
1616
Thumbs.db
1717

18-
dist/
18+
# Build
19+
dist/
20+
*.egg-info/
21+
22+
# Testing
23+
.pytest_cache/

README.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
# devolv-validator
22

3-
**devolv-validator** is a Python CLI tool that statically validates AWS IAM policies (JSON or YAML) for risky patterns such as wildcards, privilege escalation risks, and bad practices.
3+
[![PyPI - Version](https://img.shields.io/pypi/v/devolv)](https://pypi.org/project/devolv/)
4+
[![Tests](https://github.com/devolvdev/devolv/actions/workflows/test.yml/badge.svg)](https://github.com/devolvdev/devolv/actions)
5+
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6+
7+
**devolv-validator** is a subtool of the [**Devolv** OSS DevOps Toolkit](https://github.com/devolvdev).
8+
It statically validates AWS IAM policies (JSON or YAML) for risky patterns such as wildcards, privilege escalation, and misconfigurations.
9+
10+
---
411

512
## 🚀 Features
613

714
- 🚩 Detects wildcards in `Action` and `Resource`
8-
- 🔐 Flags `iam:PassRole` on wildcard `Resource`
9-
- 📂 Supports both JSON and YAML formats
10-
- ⚙️ Clean CLI built with Typer
11-
- ✅ Ready for CI with GitHub Actions
15+
- 🔐 Flags `iam:PassRole` with wildcard `Resource`
16+
- 📂 Supports both JSON and YAML input
17+
- ⚙️ Simple CLI using [Typer](https://typer.tiangolo.com/)
18+
- ✅ CI-ready with GitHub Actions
19+
20+
---
1221

1322
## 📦 Installation
1423

24+
Install the full Devolv toolkit:
25+
1526
```bash
16-
pip install devolv-validator
27+
pip install devolv
1728
```
1829

30+
---
31+
1932
## 🛠 Usage
2033

2134
```bash
22-
devolv-validator validate path/to/policy.json
35+
devolv validate file path/to/policy.json
2336
```
2437

38+
---
39+
2540
## 📁 Example
2641

2742
```json
@@ -37,14 +52,26 @@ devolv-validator validate path/to/policy.json
3752
}
3853
```
3954

40-
This policy will be flagged with high-severity warnings.
55+
This will be flagged as high-risk due to overly permissive wildcards.
56+
57+
---
4158

4259
## 🧪 Run Tests
4360

4461
```bash
4562
pytest
4663
```
4764

65+
---
66+
4867
## 🧰 About
4968

50-
This is part of the [devolv](https://github.com/devolvdev) OSS DevOps toolkit.
69+
This tool is part of the [Devolv OSS Toolkit](https://github.com/devolvdev), a growing collection of DevOps-first security and automation tools.
70+
71+
Follow the repo for upcoming modules like:
72+
73+
- `devolv scan`: analyze AWS infrastructure
74+
- `devolv generate`: produce IAM policies safely
75+
- `devolv etl`: secure CI/CD for policy transformation
76+
77+
---

structure.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
1-
from devolv.iam.validator.core import validate_policy_file
21
import tempfile
32
import json
3+
import os
4+
from devolv.iam.validator.core import validate_policy_file
45

56
def test_policy_with_wildcard_action():
67
policy = {
78
"Version": "2012-10-17",
89
"Statement": [{"Effect": "Allow", "Action": "*", "Resource": "*"}]
910
}
10-
with tempfile.NamedTemporaryFile(mode="w+", suffix=".json") as f:
11+
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as f:
1112
json.dump(policy, f)
12-
f.flush()
13-
findings = validate_policy_file(f.name)
14-
assert any("Wildcard in Action" in f["message"] for f in findings)
13+
temp_path = f.name
14+
15+
findings = validate_policy_file(temp_path)
16+
assert any("wildcard" in f["message"].lower() for f in findings)
17+
os.remove(temp_path)
1518

1619
def test_safe_policy_passes():
1720
policy = {
1821
"Version": "2012-10-17",
1922
"Statement": [{"Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::example"}]
2023
}
21-
with tempfile.NamedTemporaryFile(mode="w+", suffix=".json") as f:
24+
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as f:
2225
json.dump(policy, f)
23-
f.flush()
24-
findings = validate_policy_file(f.name)
25-
assert findings == []
26+
temp_path = f.name
27+
28+
findings = validate_policy_file(temp_path)
29+
assert not findings
30+
os.remove(temp_path)

0 commit comments

Comments
 (0)