Commit 4bc4eb1
feat(rules): add Python security rules for R2 distribution (#469)
Added Python security rules to the rules directory structure for R2 upload
and remote ruleset distribution.
**Python Rules Added:**
- PYTHON-DESER-001: Unsafe Pickle Deserialization (CRITICAL, CWE-502)
- PYTHON-DJANGO-001: Django SQL Injection in cursor.execute() (CRITICAL, CWE-89)
- PYTHON-FLASK-001: Flask Debug Mode Enabled (HIGH, CWE-489)
**Bundle Structure:**
rules/python/
├── manifest.json
├── deserialization/
│ └── pickle_loads.py
├── django/
│ └── sql_injection.py
└── flask/
└── debug_mode.py
**Changes:**
- Added rules/python/ directory with 3 security rules across 3 bundles
- Created rules/python/manifest.json with bundle metadata
- Updated rules/manifest.json to include "python" category
- Updated timestamp to 2026-01-17
**Bundles:**
1. **deserialization** - Unsafe deserialization (pickle.loads RCE)
2. **django** - Django framework security (SQL injection)
3. **flask** - Flask framework security (debug mode)
**Metadata:**
- All rules include CWE, CVE, OWASP, severity, tags
- Comprehensive documentation in each rule file
- Proper @python_rule decorators with full metadata
**Testing:**
Verified with dry-run:
```
python3 ./tools/process_rules_for_r2.py --dry-run
📦 Processing category: python
📁 Bundle: deserialization (2 files, 12.3 KB)
📁 Bundle: django (2 files, 10.6 KB)
📁 Bundle: flask (2 files, 9.7 KB)
✅ Processing complete!
```
**Next Steps:**
After merge, deploy-rules workflow will upload to R2:
- https://assets.codepathfinder.dev/rules/python/deserialization.zip
- https://assets.codepathfinder.dev/rules/python/django.zip
- https://assets.codepathfinder.dev/rules/python/flask.zip
**Usage:**
```bash
# Download and scan with Python rules
pathfinder scan --project . --ruleset python/deserialization
pathfinder scan --project . --ruleset python/PYTHON-DESER-001
```
Co-authored-by: Claude Sonnet 4.5 <[email protected]>1 parent 09659b3 commit 4bc4eb1
File tree
9 files changed
+1238
-2
lines changed- rules
- python
- deserialization
- django
- flask
9 files changed
+1238
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
Whitespace-only changes.
Whitespace-only changes.
0 commit comments