devkitx 1.0.0__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- devkitx-2.0.0/.gitignore +54 -0
- devkitx-2.0.0/PKG-INFO +352 -0
- devkitx-2.0.0/README.md +308 -0
- devkitx-2.0.0/pyproject.toml +80 -0
- devkitx-2.0.0/src/devkitx/__init__.py +56 -0
- devkitx-2.0.0/src/devkitx/_version.py +3 -0
- devkitx-2.0.0/src/devkitx/cli/__init__.py +5 -0
- devkitx-2.0.0/src/devkitx/cli/main.py +328 -0
- devkitx-2.0.0/src/devkitx/compliance/__init__.py +14 -0
- devkitx-2.0.0/src/devkitx/compliance/audit_logger.py +173 -0
- devkitx-2.0.0/src/devkitx/compliance/nist_controls.py +113 -0
- devkitx-2.0.0/src/devkitx/compliance/pii_detector.py +137 -0
- devkitx-2.0.0/src/devkitx/security/__init__.py +15 -0
- devkitx-2.0.0/src/devkitx/security/crypto.py +135 -0
- devkitx-2.0.0/src/devkitx/security/input_sanitizer.py +108 -0
- devkitx-2.0.0/src/devkitx/security/secrets_scanner.py +121 -0
- devkitx-2.0.0/src/devkitx/utils/__init__.py +18 -0
- devkitx-2.0.0/src/devkitx/utils/json_utils.py +70 -0
- devkitx-2.0.0/src/devkitx/utils/string_utils.py +124 -0
- devkitx-2.0.0/src/devkitx/utils/time_utils.py +97 -0
- devkitx-2.0.0/src/devkitx/utils/validation.py +81 -0
- devkitx-2.0.0/tests/test_compliance.py +218 -0
- devkitx-2.0.0/tests/test_security.py +116 -0
- devkitx-1.0.0/.gitignore +0 -15
- devkitx-1.0.0/LICENSE +0 -0
- devkitx-1.0.0/PKG-INFO +0 -560
- devkitx-1.0.0/README.md +0 -513
- devkitx-1.0.0/examples/README.md +0 -154
- devkitx-1.0.0/pyproject.toml +0 -95
- devkitx-1.0.0/src/devtools_py/__init__.py +0 -62
- devkitx-1.0.0/src/devtools_py/__main__.py +0 -457
- devkitx-1.0.0/src/devtools_py/async_utils.py +0 -436
- devkitx-1.0.0/src/devtools_py/cli_utils.py +0 -320
- devkitx-1.0.0/src/devtools_py/config_utils.py +0 -557
- devkitx-1.0.0/src/devtools_py/data_utils.py +0 -288
- devkitx-1.0.0/src/devtools_py/dev_utils.py +0 -393
- devkitx-1.0.0/src/devtools_py/file_utils.py +0 -211
- devkitx-1.0.0/src/devtools_py/http_utils.py +0 -346
- devkitx-1.0.0/src/devtools_py/json_utils.py +0 -244
- devkitx-1.0.0/src/devtools_py/log_utils.py +0 -158
- devkitx-1.0.0/src/devtools_py/py.typed +0 -0
- devkitx-1.0.0/src/devtools_py/security_utils.py +0 -326
- devkitx-1.0.0/src/devtools_py/string_utils.py +0 -489
- devkitx-1.0.0/src/devtools_py/system_utils.py +0 -262
- devkitx-1.0.0/src/devtools_py/time_utils.py +0 -433
- devkitx-1.0.0/src/devtools_py/validation_utils.py +0 -388
- devkitx-1.0.0/venv/lib/python3.13/site-packages/PyJWT-2.10.1.dist-info/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/anyio-4.10.0.dist-info/licenses/LICENSE +0 -20
- devkitx-1.0.0/venv/lib/python3.13/site-packages/attrs-25.3.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/bcrypt-4.3.0.dist-info/LICENSE +0 -201
- devkitx-1.0.0/venv/lib/python3.13/site-packages/black-25.1.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/blib2to3/LICENSE +0 -254
- devkitx-1.0.0/venv/lib/python3.13/site-packages/build-1.3.0.dist-info/licenses/LICENSE +0 -20
- devkitx-1.0.0/venv/lib/python3.13/site-packages/certifi-2025.8.3.dist-info/licenses/LICENSE +0 -20
- devkitx-1.0.0/venv/lib/python3.13/site-packages/charset_normalizer-3.4.3.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/dev_qol_toolkit-0.1.0.dist-info/licenses/LICENSE +0 -0
- devkitx-1.0.0/venv/lib/python3.13/site-packages/devtools_py-1.0.0.dist-info/licenses/LICENSE +0 -0
- devkitx-1.0.0/venv/lib/python3.13/site-packages/id-1.5.0.dist-info/LICENSE +0 -202
- devkitx-1.0.0/venv/lib/python3.13/site-packages/iniconfig-2.1.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/jaraco.classes-3.4.0.dist-info/LICENSE +0 -17
- devkitx-1.0.0/venv/lib/python3.13/site-packages/jaraco.context-6.0.1.dist-info/LICENSE +0 -17
- devkitx-1.0.0/venv/lib/python3.13/site-packages/jaraco_functools-4.3.0.dist-info/licenses/LICENSE +0 -18
- devkitx-1.0.0/venv/lib/python3.13/site-packages/keyring-25.6.0.dist-info/LICENSE +0 -17
- devkitx-1.0.0/venv/lib/python3.13/site-packages/markdown_it_py-4.0.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/mdurl-0.1.2.dist-info/LICENSE +0 -46
- devkitx-1.0.0/venv/lib/python3.13/site-packages/more_itertools-10.8.0.dist-info/licenses/LICENSE +0 -19
- devkitx-1.0.0/venv/lib/python3.13/site-packages/mypy/typeshed/LICENSE +0 -237
- devkitx-1.0.0/venv/lib/python3.13/site-packages/mypy-1.18.1.dist-info/licenses/LICENSE +0 -229
- devkitx-1.0.0/venv/lib/python3.13/site-packages/mypy_extensions-1.1.0.dist-info/licenses/LICENSE +0 -27
- devkitx-1.0.0/venv/lib/python3.13/site-packages/nh3-0.3.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/packaging-25.0.dist-info/licenses/LICENSE +0 -3
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pathspec-0.12.1.dist-info/LICENSE +0 -373
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/certifi/LICENSE +0 -20
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/distro/LICENSE +0 -202
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/packaging/LICENSE +0 -3
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/pkg_resources/LICENSE +0 -17
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/platformdirs/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/pygments/LICENSE +0 -25
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/pyproject_hooks/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/requests/LICENSE +0 -175
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/resolvelib/LICENSE +0 -13
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/rich/LICENSE +0 -19
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/tomli/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/tomli_w/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pip-25.2.dist-info/licenses/src/pip/_vendor/truststore/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/platformdirs-4.4.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pluggy-1.6.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pygments-2.19.2.dist-info/licenses/LICENSE +0 -25
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pyproject_hooks-1.2.0.dist-info/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pytest-8.4.2.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pytest_asyncio-1.2.0.dist-info/licenses/LICENSE +0 -201
- devkitx-1.0.0/venv/lib/python3.13/site-packages/pytest_cov-7.0.0.dist-info/licenses/LICENSE +0 -21
- devkitx-1.0.0/venv/lib/python3.13/site-packages/readme_renderer-44.0.dist-info/LICENSE +0 -174
- devkitx-1.0.0/venv/lib/python3.13/site-packages/requests-2.32.5.dist-info/licenses/LICENSE +0 -175
- devkitx-1.0.0/venv/lib/python3.13/site-packages/requests_toolbelt-1.0.0.dist-info/LICENSE +0 -13
- devkitx-1.0.0/venv/lib/python3.13/site-packages/rfc3986-2.0.0.dist-info/LICENSE +0 -13
- devkitx-1.0.0/venv/lib/python3.13/site-packages/rich-14.1.0.dist-info/LICENSE +0 -19
- devkitx-1.0.0/venv/lib/python3.13/site-packages/ruff-0.13.0.dist-info/licenses/LICENSE +0 -430
- devkitx-1.0.0/venv/lib/python3.13/site-packages/sniffio-1.3.1.dist-info/LICENSE +0 -3
- devkitx-1.0.0/venv/lib/python3.13/site-packages/sortedcontainers-2.4.0.dist-info/LICENSE +0 -13
- devkitx-1.0.0/venv/lib/python3.13/site-packages/twine-6.2.0.dist-info/licenses/LICENSE +0 -174
- devkitx-1.0.0/venv/lib/python3.13/site-packages/types_requests-2.32.4.20250809.dist-info/licenses/LICENSE +0 -237
- devkitx-1.0.0/venv/lib/python3.13/site-packages/typing_extensions-4.15.0.dist-info/licenses/LICENSE +0 -279
devkitx-2.0.0/.gitignore
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
*.egg-info/
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
env/
|
|
10
|
+
ENV/
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.tox/
|
|
18
|
+
.eggs/
|
|
19
|
+
|
|
20
|
+
# Security & Secrets
|
|
21
|
+
.env
|
|
22
|
+
.env.*
|
|
23
|
+
!.env.example
|
|
24
|
+
!.env.template
|
|
25
|
+
.pypirc
|
|
26
|
+
*.key
|
|
27
|
+
*.pem
|
|
28
|
+
*.p12
|
|
29
|
+
*.pfx
|
|
30
|
+
secrets.json
|
|
31
|
+
.secrets
|
|
32
|
+
config/secrets/
|
|
33
|
+
credentials.json
|
|
34
|
+
|
|
35
|
+
# IDE & Editors
|
|
36
|
+
.vscode/
|
|
37
|
+
.idea/
|
|
38
|
+
*.swp
|
|
39
|
+
*.swo
|
|
40
|
+
*~
|
|
41
|
+
.DS_Store
|
|
42
|
+
Thumbs.db
|
|
43
|
+
|
|
44
|
+
# Logs
|
|
45
|
+
*.log
|
|
46
|
+
logs/
|
|
47
|
+
|
|
48
|
+
# Temporary files
|
|
49
|
+
*.tmp
|
|
50
|
+
*.temp
|
|
51
|
+
.cache/
|
|
52
|
+
|
|
53
|
+
# Kiro
|
|
54
|
+
.kiro/
|
devkitx-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devkitx
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Security-first Python utilities for government, healthcare, and financial applications.
|
|
5
|
+
Project-URL: Homepage, https://github.com/SerityOps/devkitx
|
|
6
|
+
Project-URL: Documentation, https://devkitx.readthedocs.io
|
|
7
|
+
Project-URL: Repository, https://github.com/SerityOps/devkitx
|
|
8
|
+
Project-URL: Issues, https://github.com/SerityOps/devkitx/issues
|
|
9
|
+
Author: LadyCami
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: audit,compliance,fedramp,hipaa,nist,pii,secrets,security,soc2,utilities
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: asyncbridge>=1.0.0
|
|
24
|
+
Requires-Dist: confmerge>=1.0.0
|
|
25
|
+
Requires-Dist: httpx-defaults>=1.0.0
|
|
26
|
+
Provides-Extra: all
|
|
27
|
+
Requires-Dist: rich>=13.0.0; extra == 'all'
|
|
28
|
+
Requires-Dist: structlog>=23.0.0; extra == 'all'
|
|
29
|
+
Requires-Dist: typer>=0.9.0; extra == 'all'
|
|
30
|
+
Provides-Extra: audit
|
|
31
|
+
Requires-Dist: structlog>=23.0.0; extra == 'audit'
|
|
32
|
+
Provides-Extra: cli
|
|
33
|
+
Requires-Dist: rich>=13.0.0; extra == 'cli'
|
|
34
|
+
Requires-Dist: typer>=0.9.0; extra == 'cli'
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: rich>=13.0.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: structlog>=23.0.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: typer>=0.9.0; extra == 'dev'
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
# DevKitX
|
|
46
|
+
|
|
47
|
+
> Security-first Python utilities for government, healthcare, and financial applications.
|
|
48
|
+
|
|
49
|
+
[](https://pypi.org/project/devkitx/)
|
|
50
|
+
[](https://www.python.org/downloads/)
|
|
51
|
+
[](https://opensource.org/licenses/MIT)
|
|
52
|
+
|
|
53
|
+
## Why DevKitX?
|
|
54
|
+
|
|
55
|
+
Most Python utility libraries optimize for convenience. DevKitX optimizes for **security and compliance**.
|
|
56
|
+
|
|
57
|
+
| Feature | Generic Libraries | DevKitX |
|
|
58
|
+
|---------|-------------------|---------|
|
|
59
|
+
| HTTP timeouts | Optional | **Enforced by default** |
|
|
60
|
+
| Secret detection | Not included | **Built-in scanner** |
|
|
61
|
+
| Audit logging | DIY | **NIST AU-3 compliant** |
|
|
62
|
+
| PII detection | Not included | **Automatic scanning** |
|
|
63
|
+
| Config secrets | Mixed with config | **Env-only pattern enforced** |
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install devkitx
|
|
69
|
+
|
|
70
|
+
# Scan for hardcoded secrets
|
|
71
|
+
devkitx audit secrets ./src
|
|
72
|
+
|
|
73
|
+
# Scan for PII
|
|
74
|
+
devkitx audit pii ./data
|
|
75
|
+
|
|
76
|
+
# Check dependencies for CVEs
|
|
77
|
+
devkitx audit deps
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## For Developers
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from devkitx.security import SecretsScanner
|
|
84
|
+
from devkitx.compliance import AuditLogger, PIIDetector
|
|
85
|
+
|
|
86
|
+
# Audit logging that meets NIST 800-53 AU controls
|
|
87
|
+
logger = AuditLogger(service="my-api")
|
|
88
|
+
logger.log_auth("user_login", user_id="123", outcome="success")
|
|
89
|
+
|
|
90
|
+
# Scan uploads for PII before storage
|
|
91
|
+
detector = PIIDetector()
|
|
92
|
+
matches = detector.scan_text(user_input)
|
|
93
|
+
if matches:
|
|
94
|
+
raise ValueError(f"PII detected: {[m.pii_type for m in matches]}")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Micro-Packages
|
|
98
|
+
|
|
99
|
+
Need just one feature? Install the standalone packages:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install asyncbridge # Async/sync conversion
|
|
103
|
+
pip install httpx-defaults # Production-ready HTTP client
|
|
104
|
+
pip install confmerge # Multi-format config loading
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Compliance Mapping
|
|
108
|
+
|
|
109
|
+
DevKitX features map to common compliance frameworks:
|
|
110
|
+
|
|
111
|
+
| DevKitX Feature | NIST 800-53 | SOC 2 | HIPAA |
|
|
112
|
+
|-----------------|-------------|-------|-------|
|
|
113
|
+
| AuditLogger | AU-2, AU-3, AU-9 | CC7.2 | 164.312(b) |
|
|
114
|
+
| SecretsScanner | SA-3, SC-28 | CC6.1 | 164.312(a)(1) |
|
|
115
|
+
| PIIDetector | SI-12, PM-25 | CC6.5 | 164.514 |
|
|
116
|
+
| SecureClient | SC-8, SC-13 | CC6.6 | 164.312(e)(1) |
|
|
117
|
+
|
|
118
|
+
## Installation
|
|
119
|
+
|
|
120
|
+
### Main Package
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Basic installation
|
|
124
|
+
pip install devkitx
|
|
125
|
+
|
|
126
|
+
# With CLI support
|
|
127
|
+
pip install devkitx[cli]
|
|
128
|
+
|
|
129
|
+
# With all features
|
|
130
|
+
pip install devkitx[all]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Micro-Packages
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Zero-dependency async/sync conversion
|
|
137
|
+
pip install asyncbridge
|
|
138
|
+
|
|
139
|
+
# Production HTTP client with secure defaults
|
|
140
|
+
pip install httpx-defaults
|
|
141
|
+
|
|
142
|
+
# Multi-format config loading
|
|
143
|
+
pip install confmerge
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Features
|
|
147
|
+
|
|
148
|
+
### 🔒 Security & Compliance
|
|
149
|
+
- **Secrets Scanner**: Detect hardcoded API keys, passwords, tokens
|
|
150
|
+
- **PII Detector**: Find personally identifiable information in text/files
|
|
151
|
+
- **Audit Logger**: NIST 800-53 AU-3 compliant structured logging
|
|
152
|
+
- **Input Sanitization**: Prevent XSS, SQL injection, path traversal
|
|
153
|
+
|
|
154
|
+
### 🌐 Secure HTTP
|
|
155
|
+
- **Production Defaults**: Timeouts, connection limits, retry logic
|
|
156
|
+
- **Security Warnings**: Alert on insecure HTTP usage
|
|
157
|
+
- **Certificate Verification**: Enforced by default
|
|
158
|
+
|
|
159
|
+
### ⚙️ Configuration
|
|
160
|
+
- **Multi-format Support**: JSON, YAML, TOML, .env files
|
|
161
|
+
- **Secret Detection**: Warn when secrets found in config files
|
|
162
|
+
- **Environment Integration**: Secure environment variable handling
|
|
163
|
+
|
|
164
|
+
### ⚡ Async/Sync Bridges
|
|
165
|
+
- **Zero Dependencies**: Pure stdlib implementation
|
|
166
|
+
- **Event Loop Safe**: Proper handling of running loops
|
|
167
|
+
- **Thread Pool**: Non-blocking sync function execution
|
|
168
|
+
|
|
169
|
+
### 🛠️ CLI Tools
|
|
170
|
+
- **Security Auditing**: `devkitx audit secrets`, `devkitx audit pii`
|
|
171
|
+
- **Dependency Scanning**: `devkitx audit deps`
|
|
172
|
+
- **Project Scaffolding**: `devkitx init my-project`
|
|
173
|
+
- **Utility Commands**: JSON, string, config operations
|
|
174
|
+
|
|
175
|
+
## CLI Usage
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Install with CLI support
|
|
179
|
+
pip install devkitx[cli]
|
|
180
|
+
|
|
181
|
+
# Security auditing
|
|
182
|
+
devkitx audit secrets ./src # Scan for hardcoded secrets
|
|
183
|
+
devkitx audit pii ./data # Scan for PII
|
|
184
|
+
devkitx audit deps # Check for vulnerable dependencies
|
|
185
|
+
|
|
186
|
+
# Project management
|
|
187
|
+
devkitx init my-secure-project # Create project with secure defaults
|
|
188
|
+
|
|
189
|
+
# Utilities
|
|
190
|
+
devkitx json flatten config.json # Flatten nested JSON
|
|
191
|
+
devkitx string convert "MyClass" --to snake # Convert case formats
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## API Examples
|
|
195
|
+
|
|
196
|
+
### Audit Logging
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from devkitx.compliance import AuditLogger
|
|
200
|
+
|
|
201
|
+
# Initialize logger for your service
|
|
202
|
+
logger = AuditLogger(service="user-api")
|
|
203
|
+
|
|
204
|
+
# Log authentication events
|
|
205
|
+
logger.log_auth(
|
|
206
|
+
action="login",
|
|
207
|
+
user_id="user123",
|
|
208
|
+
outcome="success",
|
|
209
|
+
source_ip="192.168.1.100"
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
# Log data access
|
|
213
|
+
logger.log_access(
|
|
214
|
+
action="read",
|
|
215
|
+
resource_type="user_profile",
|
|
216
|
+
resource_id="profile456",
|
|
217
|
+
user_id="user123"
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
# Log data changes with diff
|
|
221
|
+
logger.log_change(
|
|
222
|
+
action="update",
|
|
223
|
+
resource_type="user_profile",
|
|
224
|
+
resource_id="profile456",
|
|
225
|
+
user_id="user123",
|
|
226
|
+
changes={"email": {"old": "old@example.com", "new": "new@example.com"}}
|
|
227
|
+
)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Security Scanning
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
from devkitx.security import SecretsScanner
|
|
234
|
+
from devkitx.compliance import PIIDetector
|
|
235
|
+
|
|
236
|
+
# Scan for hardcoded secrets
|
|
237
|
+
scanner = SecretsScanner()
|
|
238
|
+
for secret in scanner.scan_directory("./src"):
|
|
239
|
+
print(f"🚨 {secret.secret_type} found in {secret.file_path}:{secret.line_number}")
|
|
240
|
+
print(f" Severity: {secret.severity}")
|
|
241
|
+
print(f" Value: {secret.redacted}")
|
|
242
|
+
|
|
243
|
+
# Scan for PII
|
|
244
|
+
detector = PIIDetector()
|
|
245
|
+
text = "Contact John Doe at john.doe@company.com or 555-123-4567"
|
|
246
|
+
for match in detector.scan_text(text):
|
|
247
|
+
print(f"PII detected: {match.pii_type} = {match.redacted}")
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Secure HTTP Client
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
from devkitx import SecureClient
|
|
254
|
+
|
|
255
|
+
# HTTP client with production-ready defaults
|
|
256
|
+
with SecureClient() as client:
|
|
257
|
+
# Automatic timeouts, connection limits, security warnings
|
|
258
|
+
response = client.get("https://api.example.com/data")
|
|
259
|
+
data = response.json()
|
|
260
|
+
|
|
261
|
+
# Async version
|
|
262
|
+
from devkitx import SecureAsyncClient
|
|
263
|
+
|
|
264
|
+
async def fetch_data():
|
|
265
|
+
async with SecureAsyncClient() as client:
|
|
266
|
+
response = await client.get("https://api.example.com/data")
|
|
267
|
+
return response.json()
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Configuration Management
|
|
271
|
+
|
|
272
|
+
```python
|
|
273
|
+
from devkitx import load_config, merge_config
|
|
274
|
+
|
|
275
|
+
# Load and merge multiple config sources
|
|
276
|
+
config = load_config(
|
|
277
|
+
"config.yaml", # Base configuration
|
|
278
|
+
"config.local.yaml", # Local overrides
|
|
279
|
+
env_prefix="APP_" # Environment variables (APP_*)
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
# Access nested configuration
|
|
283
|
+
db_host = config.get("database.host", "localhost")
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Async/Sync Conversion
|
|
287
|
+
|
|
288
|
+
```python
|
|
289
|
+
from devkitx import async_to_sync, sync_to_async
|
|
290
|
+
|
|
291
|
+
# Convert async function to sync
|
|
292
|
+
async def fetch_user(user_id):
|
|
293
|
+
# ... async database call
|
|
294
|
+
return user
|
|
295
|
+
|
|
296
|
+
get_user = async_to_sync(fetch_user)
|
|
297
|
+
user = get_user(123) # Works in sync context
|
|
298
|
+
|
|
299
|
+
# Convert sync function to async (runs in thread pool)
|
|
300
|
+
def expensive_calculation(data):
|
|
301
|
+
# ... CPU intensive work
|
|
302
|
+
return result
|
|
303
|
+
|
|
304
|
+
async_calc = sync_to_async(expensive_calculation)
|
|
305
|
+
result = await async_calc(data) # Non-blocking
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Compliance Features
|
|
309
|
+
|
|
310
|
+
### NIST 800-53 Controls
|
|
311
|
+
|
|
312
|
+
DevKitX helps implement several NIST 800-53 security controls:
|
|
313
|
+
|
|
314
|
+
- **AU-2 (Audit Events)**: AuditLogger identifies auditable events
|
|
315
|
+
- **AU-3 (Content of Audit Records)**: Structured logging with required fields
|
|
316
|
+
- **AU-9 (Protection of Audit Information)**: Tamper-evident audit chains
|
|
317
|
+
- **SA-3 (System Development Life Cycle)**: Security scanning in development
|
|
318
|
+
- **SC-8 (Transmission Confidentiality)**: Secure HTTP defaults
|
|
319
|
+
- **SC-28 (Protection of Information at Rest)**: Secret detection
|
|
320
|
+
- **SI-12 (Information Handling)**: PII detection and handling
|
|
321
|
+
- **PM-25 (PII Minimization)**: Automated PII discovery
|
|
322
|
+
|
|
323
|
+
### SOC 2 Type II
|
|
324
|
+
|
|
325
|
+
- **CC6.1 (Logical Access)**: Secret scanning prevents credential exposure
|
|
326
|
+
- **CC6.5 (Data Classification)**: PII detection supports data classification
|
|
327
|
+
- **CC6.6 (Data Transmission)**: Secure HTTP client protects data in transit
|
|
328
|
+
- **CC7.2 (System Monitoring)**: Audit logging provides security monitoring
|
|
329
|
+
|
|
330
|
+
### HIPAA Compliance
|
|
331
|
+
|
|
332
|
+
- **164.312(a)(1) (Access Control)**: Secret scanning prevents unauthorized access
|
|
333
|
+
- **164.312(b) (Audit Controls)**: Audit logging tracks access to PHI
|
|
334
|
+
- **164.312(e)(1) (Transmission Security)**: Secure HTTP protects PHI in transit
|
|
335
|
+
- **164.514 (De-identification)**: PII detection helps identify PHI
|
|
336
|
+
|
|
337
|
+
## Requirements
|
|
338
|
+
|
|
339
|
+
- Python 3.10+
|
|
340
|
+
- Core dependencies: asyncbridge, httpx-defaults, confmerge
|
|
341
|
+
|
|
342
|
+
## License
|
|
343
|
+
|
|
344
|
+
MIT License - Free for commercial use
|
|
345
|
+
|
|
346
|
+
## Security
|
|
347
|
+
|
|
348
|
+
For security vulnerabilities, please email security@serityops.com instead of creating public issues.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
**Built for regulated environments. Trusted by government, healthcare, and financial organizations.**
|
devkitx-2.0.0/README.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# DevKitX
|
|
2
|
+
|
|
3
|
+
> Security-first Python utilities for government, healthcare, and financial applications.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/devkitx/)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
## Why DevKitX?
|
|
10
|
+
|
|
11
|
+
Most Python utility libraries optimize for convenience. DevKitX optimizes for **security and compliance**.
|
|
12
|
+
|
|
13
|
+
| Feature | Generic Libraries | DevKitX |
|
|
14
|
+
|---------|-------------------|---------|
|
|
15
|
+
| HTTP timeouts | Optional | **Enforced by default** |
|
|
16
|
+
| Secret detection | Not included | **Built-in scanner** |
|
|
17
|
+
| Audit logging | DIY | **NIST AU-3 compliant** |
|
|
18
|
+
| PII detection | Not included | **Automatic scanning** |
|
|
19
|
+
| Config secrets | Mixed with config | **Env-only pattern enforced** |
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install devkitx
|
|
25
|
+
|
|
26
|
+
# Scan for hardcoded secrets
|
|
27
|
+
devkitx audit secrets ./src
|
|
28
|
+
|
|
29
|
+
# Scan for PII
|
|
30
|
+
devkitx audit pii ./data
|
|
31
|
+
|
|
32
|
+
# Check dependencies for CVEs
|
|
33
|
+
devkitx audit deps
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## For Developers
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from devkitx.security import SecretsScanner
|
|
40
|
+
from devkitx.compliance import AuditLogger, PIIDetector
|
|
41
|
+
|
|
42
|
+
# Audit logging that meets NIST 800-53 AU controls
|
|
43
|
+
logger = AuditLogger(service="my-api")
|
|
44
|
+
logger.log_auth("user_login", user_id="123", outcome="success")
|
|
45
|
+
|
|
46
|
+
# Scan uploads for PII before storage
|
|
47
|
+
detector = PIIDetector()
|
|
48
|
+
matches = detector.scan_text(user_input)
|
|
49
|
+
if matches:
|
|
50
|
+
raise ValueError(f"PII detected: {[m.pii_type for m in matches]}")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Micro-Packages
|
|
54
|
+
|
|
55
|
+
Need just one feature? Install the standalone packages:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install asyncbridge # Async/sync conversion
|
|
59
|
+
pip install httpx-defaults # Production-ready HTTP client
|
|
60
|
+
pip install confmerge # Multi-format config loading
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Compliance Mapping
|
|
64
|
+
|
|
65
|
+
DevKitX features map to common compliance frameworks:
|
|
66
|
+
|
|
67
|
+
| DevKitX Feature | NIST 800-53 | SOC 2 | HIPAA |
|
|
68
|
+
|-----------------|-------------|-------|-------|
|
|
69
|
+
| AuditLogger | AU-2, AU-3, AU-9 | CC7.2 | 164.312(b) |
|
|
70
|
+
| SecretsScanner | SA-3, SC-28 | CC6.1 | 164.312(a)(1) |
|
|
71
|
+
| PIIDetector | SI-12, PM-25 | CC6.5 | 164.514 |
|
|
72
|
+
| SecureClient | SC-8, SC-13 | CC6.6 | 164.312(e)(1) |
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
### Main Package
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Basic installation
|
|
80
|
+
pip install devkitx
|
|
81
|
+
|
|
82
|
+
# With CLI support
|
|
83
|
+
pip install devkitx[cli]
|
|
84
|
+
|
|
85
|
+
# With all features
|
|
86
|
+
pip install devkitx[all]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Micro-Packages
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Zero-dependency async/sync conversion
|
|
93
|
+
pip install asyncbridge
|
|
94
|
+
|
|
95
|
+
# Production HTTP client with secure defaults
|
|
96
|
+
pip install httpx-defaults
|
|
97
|
+
|
|
98
|
+
# Multi-format config loading
|
|
99
|
+
pip install confmerge
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Features
|
|
103
|
+
|
|
104
|
+
### 🔒 Security & Compliance
|
|
105
|
+
- **Secrets Scanner**: Detect hardcoded API keys, passwords, tokens
|
|
106
|
+
- **PII Detector**: Find personally identifiable information in text/files
|
|
107
|
+
- **Audit Logger**: NIST 800-53 AU-3 compliant structured logging
|
|
108
|
+
- **Input Sanitization**: Prevent XSS, SQL injection, path traversal
|
|
109
|
+
|
|
110
|
+
### 🌐 Secure HTTP
|
|
111
|
+
- **Production Defaults**: Timeouts, connection limits, retry logic
|
|
112
|
+
- **Security Warnings**: Alert on insecure HTTP usage
|
|
113
|
+
- **Certificate Verification**: Enforced by default
|
|
114
|
+
|
|
115
|
+
### ⚙️ Configuration
|
|
116
|
+
- **Multi-format Support**: JSON, YAML, TOML, .env files
|
|
117
|
+
- **Secret Detection**: Warn when secrets found in config files
|
|
118
|
+
- **Environment Integration**: Secure environment variable handling
|
|
119
|
+
|
|
120
|
+
### ⚡ Async/Sync Bridges
|
|
121
|
+
- **Zero Dependencies**: Pure stdlib implementation
|
|
122
|
+
- **Event Loop Safe**: Proper handling of running loops
|
|
123
|
+
- **Thread Pool**: Non-blocking sync function execution
|
|
124
|
+
|
|
125
|
+
### 🛠️ CLI Tools
|
|
126
|
+
- **Security Auditing**: `devkitx audit secrets`, `devkitx audit pii`
|
|
127
|
+
- **Dependency Scanning**: `devkitx audit deps`
|
|
128
|
+
- **Project Scaffolding**: `devkitx init my-project`
|
|
129
|
+
- **Utility Commands**: JSON, string, config operations
|
|
130
|
+
|
|
131
|
+
## CLI Usage
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Install with CLI support
|
|
135
|
+
pip install devkitx[cli]
|
|
136
|
+
|
|
137
|
+
# Security auditing
|
|
138
|
+
devkitx audit secrets ./src # Scan for hardcoded secrets
|
|
139
|
+
devkitx audit pii ./data # Scan for PII
|
|
140
|
+
devkitx audit deps # Check for vulnerable dependencies
|
|
141
|
+
|
|
142
|
+
# Project management
|
|
143
|
+
devkitx init my-secure-project # Create project with secure defaults
|
|
144
|
+
|
|
145
|
+
# Utilities
|
|
146
|
+
devkitx json flatten config.json # Flatten nested JSON
|
|
147
|
+
devkitx string convert "MyClass" --to snake # Convert case formats
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## API Examples
|
|
151
|
+
|
|
152
|
+
### Audit Logging
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from devkitx.compliance import AuditLogger
|
|
156
|
+
|
|
157
|
+
# Initialize logger for your service
|
|
158
|
+
logger = AuditLogger(service="user-api")
|
|
159
|
+
|
|
160
|
+
# Log authentication events
|
|
161
|
+
logger.log_auth(
|
|
162
|
+
action="login",
|
|
163
|
+
user_id="user123",
|
|
164
|
+
outcome="success",
|
|
165
|
+
source_ip="192.168.1.100"
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
# Log data access
|
|
169
|
+
logger.log_access(
|
|
170
|
+
action="read",
|
|
171
|
+
resource_type="user_profile",
|
|
172
|
+
resource_id="profile456",
|
|
173
|
+
user_id="user123"
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
# Log data changes with diff
|
|
177
|
+
logger.log_change(
|
|
178
|
+
action="update",
|
|
179
|
+
resource_type="user_profile",
|
|
180
|
+
resource_id="profile456",
|
|
181
|
+
user_id="user123",
|
|
182
|
+
changes={"email": {"old": "old@example.com", "new": "new@example.com"}}
|
|
183
|
+
)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Security Scanning
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from devkitx.security import SecretsScanner
|
|
190
|
+
from devkitx.compliance import PIIDetector
|
|
191
|
+
|
|
192
|
+
# Scan for hardcoded secrets
|
|
193
|
+
scanner = SecretsScanner()
|
|
194
|
+
for secret in scanner.scan_directory("./src"):
|
|
195
|
+
print(f"🚨 {secret.secret_type} found in {secret.file_path}:{secret.line_number}")
|
|
196
|
+
print(f" Severity: {secret.severity}")
|
|
197
|
+
print(f" Value: {secret.redacted}")
|
|
198
|
+
|
|
199
|
+
# Scan for PII
|
|
200
|
+
detector = PIIDetector()
|
|
201
|
+
text = "Contact John Doe at john.doe@company.com or 555-123-4567"
|
|
202
|
+
for match in detector.scan_text(text):
|
|
203
|
+
print(f"PII detected: {match.pii_type} = {match.redacted}")
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Secure HTTP Client
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
from devkitx import SecureClient
|
|
210
|
+
|
|
211
|
+
# HTTP client with production-ready defaults
|
|
212
|
+
with SecureClient() as client:
|
|
213
|
+
# Automatic timeouts, connection limits, security warnings
|
|
214
|
+
response = client.get("https://api.example.com/data")
|
|
215
|
+
data = response.json()
|
|
216
|
+
|
|
217
|
+
# Async version
|
|
218
|
+
from devkitx import SecureAsyncClient
|
|
219
|
+
|
|
220
|
+
async def fetch_data():
|
|
221
|
+
async with SecureAsyncClient() as client:
|
|
222
|
+
response = await client.get("https://api.example.com/data")
|
|
223
|
+
return response.json()
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Configuration Management
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from devkitx import load_config, merge_config
|
|
230
|
+
|
|
231
|
+
# Load and merge multiple config sources
|
|
232
|
+
config = load_config(
|
|
233
|
+
"config.yaml", # Base configuration
|
|
234
|
+
"config.local.yaml", # Local overrides
|
|
235
|
+
env_prefix="APP_" # Environment variables (APP_*)
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
# Access nested configuration
|
|
239
|
+
db_host = config.get("database.host", "localhost")
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Async/Sync Conversion
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
from devkitx import async_to_sync, sync_to_async
|
|
246
|
+
|
|
247
|
+
# Convert async function to sync
|
|
248
|
+
async def fetch_user(user_id):
|
|
249
|
+
# ... async database call
|
|
250
|
+
return user
|
|
251
|
+
|
|
252
|
+
get_user = async_to_sync(fetch_user)
|
|
253
|
+
user = get_user(123) # Works in sync context
|
|
254
|
+
|
|
255
|
+
# Convert sync function to async (runs in thread pool)
|
|
256
|
+
def expensive_calculation(data):
|
|
257
|
+
# ... CPU intensive work
|
|
258
|
+
return result
|
|
259
|
+
|
|
260
|
+
async_calc = sync_to_async(expensive_calculation)
|
|
261
|
+
result = await async_calc(data) # Non-blocking
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Compliance Features
|
|
265
|
+
|
|
266
|
+
### NIST 800-53 Controls
|
|
267
|
+
|
|
268
|
+
DevKitX helps implement several NIST 800-53 security controls:
|
|
269
|
+
|
|
270
|
+
- **AU-2 (Audit Events)**: AuditLogger identifies auditable events
|
|
271
|
+
- **AU-3 (Content of Audit Records)**: Structured logging with required fields
|
|
272
|
+
- **AU-9 (Protection of Audit Information)**: Tamper-evident audit chains
|
|
273
|
+
- **SA-3 (System Development Life Cycle)**: Security scanning in development
|
|
274
|
+
- **SC-8 (Transmission Confidentiality)**: Secure HTTP defaults
|
|
275
|
+
- **SC-28 (Protection of Information at Rest)**: Secret detection
|
|
276
|
+
- **SI-12 (Information Handling)**: PII detection and handling
|
|
277
|
+
- **PM-25 (PII Minimization)**: Automated PII discovery
|
|
278
|
+
|
|
279
|
+
### SOC 2 Type II
|
|
280
|
+
|
|
281
|
+
- **CC6.1 (Logical Access)**: Secret scanning prevents credential exposure
|
|
282
|
+
- **CC6.5 (Data Classification)**: PII detection supports data classification
|
|
283
|
+
- **CC6.6 (Data Transmission)**: Secure HTTP client protects data in transit
|
|
284
|
+
- **CC7.2 (System Monitoring)**: Audit logging provides security monitoring
|
|
285
|
+
|
|
286
|
+
### HIPAA Compliance
|
|
287
|
+
|
|
288
|
+
- **164.312(a)(1) (Access Control)**: Secret scanning prevents unauthorized access
|
|
289
|
+
- **164.312(b) (Audit Controls)**: Audit logging tracks access to PHI
|
|
290
|
+
- **164.312(e)(1) (Transmission Security)**: Secure HTTP protects PHI in transit
|
|
291
|
+
- **164.514 (De-identification)**: PII detection helps identify PHI
|
|
292
|
+
|
|
293
|
+
## Requirements
|
|
294
|
+
|
|
295
|
+
- Python 3.10+
|
|
296
|
+
- Core dependencies: asyncbridge, httpx-defaults, confmerge
|
|
297
|
+
|
|
298
|
+
## License
|
|
299
|
+
|
|
300
|
+
MIT License - Free for commercial use
|
|
301
|
+
|
|
302
|
+
## Security
|
|
303
|
+
|
|
304
|
+
For security vulnerabilities, please email security@serityops.com instead of creating public issues.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
**Built for regulated environments. Trusted by government, healthcare, and financial organizations.**
|