devkitx 2.0.1__tar.gz → 2.1.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.1.0/.env.example +9 -0
- devkitx-2.1.0/.gitattributes +4 -0
- devkitx-2.1.0/.github/workflows/ci.yml +102 -0
- devkitx-2.1.0/.github/workflows/release.yml +100 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/.gitignore +54 -54
- devkitx-2.1.0/CHANGELOG.md +182 -0
- devkitx-2.1.0/LICENSE +0 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/PKG-INFO +77 -34
- {devkitx-2.0.1 → devkitx-2.1.0}/README.md +328 -307
- devkitx-2.1.0/SECURITY.md +177 -0
- devkitx-2.1.0/pyproject.toml +106 -0
- devkitx-2.1.0/scripts/publish.py +192 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/__init__.py +59 -56
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/_version.py +3 -3
- devkitx-2.1.0/src/devkitx/async_bridge.py +103 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/cli/__init__.py +5 -5
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/cli/main.py +349 -328
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/compliance/__init__.py +16 -14
- devkitx-2.1.0/src/devkitx/compliance/audit_logger.py +298 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/compliance/nist_controls.py +113 -113
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/compliance/pii_detector.py +150 -137
- devkitx-2.1.0/src/devkitx/config.py +210 -0
- devkitx-2.1.0/src/devkitx/http_client.py +147 -0
- devkitx-2.1.0/src/devkitx/security/__init__.py +16 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/security/crypto.py +150 -135
- devkitx-2.1.0/src/devkitx/security/input_sanitizer.py +301 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/security/secrets_scanner.py +125 -121
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/utils/__init__.py +18 -18
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/utils/json_utils.py +71 -70
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/utils/string_utils.py +124 -124
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/utils/time_utils.py +96 -97
- {devkitx-2.0.1 → devkitx-2.1.0}/src/devkitx/utils/validation.py +77 -81
- devkitx-2.1.0/tests/test_async_bridge.py +55 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/tests/test_compliance.py +208 -218
- devkitx-2.1.0/tests/test_config.py +91 -0
- devkitx-2.1.0/tests/test_http_client.py +113 -0
- {devkitx-2.0.1 → devkitx-2.1.0}/tests/test_security.py +117 -116
- devkitx-2.1.0/tests/test_security_regressions.py +314 -0
- devkitx-2.0.1/pyproject.toml +0 -80
- devkitx-2.0.1/src/devkitx/compliance/audit_logger.py +0 -173
- devkitx-2.0.1/src/devkitx/security/__init__.py +0 -15
- devkitx-2.0.1/src/devkitx/security/input_sanitizer.py +0 -108
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Copy to .env (gitignored, never commit it) and fill in, then: chmod 600 .env
|
|
2
|
+
# Used by scripts/publish.py for local uploads. CI releases need no token:
|
|
3
|
+
# they use PyPI trusted publishing (.github/workflows/release.yml).
|
|
4
|
+
#
|
|
5
|
+
# Create project-scoped tokens at https://pypi.org/manage/account/token/
|
|
6
|
+
# and https://test.pypi.org/manage/account/token/
|
|
7
|
+
PYPI_USERNAME=__token__
|
|
8
|
+
PYPI_TOKEN=
|
|
9
|
+
TEST_PYPI_TOKEN=
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["develop"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["develop"]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ci-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
lint:
|
|
19
|
+
name: Lint and type-check
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.13"
|
|
28
|
+
- run: python -m pip install -U pip
|
|
29
|
+
- run: pip install -e ".[dev]"
|
|
30
|
+
- name: ruff
|
|
31
|
+
run: ruff check src tests scripts
|
|
32
|
+
- name: ruff format
|
|
33
|
+
run: ruff format --check src tests scripts
|
|
34
|
+
- name: mypy (strict)
|
|
35
|
+
run: mypy src/devkitx scripts/publish.py
|
|
36
|
+
- name: mypy (strict, Python 3.10 semantics)
|
|
37
|
+
run: mypy --python-version 3.10 src/devkitx
|
|
38
|
+
|
|
39
|
+
test:
|
|
40
|
+
name: Tests (Python ${{ matrix.python-version }})
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
strategy:
|
|
43
|
+
fail-fast: false
|
|
44
|
+
matrix:
|
|
45
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
48
|
+
with:
|
|
49
|
+
persist-credentials: false
|
|
50
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
51
|
+
with:
|
|
52
|
+
python-version: ${{ matrix.python-version }}
|
|
53
|
+
- run: python -m pip install -U pip
|
|
54
|
+
- run: pip install -e ".[dev]"
|
|
55
|
+
- name: Tests with coverage
|
|
56
|
+
run: pytest -q --cov-fail-under=55
|
|
57
|
+
- name: Doctests
|
|
58
|
+
run: pytest -q -o addopts="" --doctest-modules src/devkitx/security src/devkitx/utils src/devkitx/config.py
|
|
59
|
+
|
|
60
|
+
security:
|
|
61
|
+
name: Security scan
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
65
|
+
with:
|
|
66
|
+
persist-credentials: false
|
|
67
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
68
|
+
with:
|
|
69
|
+
python-version: "3.13"
|
|
70
|
+
- run: python -m pip install -U pip
|
|
71
|
+
- name: Install package (non-editable) with all extras
|
|
72
|
+
run: pip install ".[all]" "bandit>=1.7" "pip-audit>=2.7"
|
|
73
|
+
- name: bandit
|
|
74
|
+
run: bandit -q -r src -ll
|
|
75
|
+
- name: pip-audit (installed dependencies)
|
|
76
|
+
# Audit everything installed except devkitx itself: an unreleased
|
|
77
|
+
# version can't be looked up on PyPI and would fail --strict.
|
|
78
|
+
run: |
|
|
79
|
+
pip freeze --exclude devkitx > "$RUNNER_TEMP/requirements-audit.txt"
|
|
80
|
+
pip-audit --strict --disable-pip --no-deps -r "$RUNNER_TEMP/requirements-audit.txt"
|
|
81
|
+
|
|
82
|
+
build:
|
|
83
|
+
name: Build and install check
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
needs: [lint, test, security]
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
88
|
+
with:
|
|
89
|
+
persist-credentials: false
|
|
90
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
91
|
+
with:
|
|
92
|
+
python-version: "3.13"
|
|
93
|
+
- run: python -m pip install -U pip build twine
|
|
94
|
+
- name: Build sdist and wheel
|
|
95
|
+
run: python -m build
|
|
96
|
+
- name: twine check
|
|
97
|
+
run: twine check --strict dist/*
|
|
98
|
+
- name: Install the wheel in a clean venv and import it
|
|
99
|
+
run: |
|
|
100
|
+
python -m venv /tmp/smoke
|
|
101
|
+
/tmp/smoke/bin/pip install dist/*.whl
|
|
102
|
+
/tmp/smoke/bin/python -c "import devkitx, devkitx.security, devkitx.compliance; print(devkitx.__version__)"
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a version tag (v1.2.3) is pushed.
|
|
4
|
+
# Uses PyPI trusted publishing (OIDC): no API token is stored in GitHub.
|
|
5
|
+
# One-time setup on pypi.org -> devkitx -> Settings -> Publishing:
|
|
6
|
+
# owner: ladycami, repository: devkitx, workflow: release.yml, environment: pypi
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
name: Verify and build
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
outputs:
|
|
20
|
+
already-published: ${{ steps.pypi.outputs.exists }}
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.13"
|
|
29
|
+
- run: python -m pip install -U pip
|
|
30
|
+
- run: pip install -e ".[dev]"
|
|
31
|
+
- name: Tag must match package version
|
|
32
|
+
run: |
|
|
33
|
+
version=$(python -c "import devkitx; print(devkitx.__version__)")
|
|
34
|
+
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
|
|
35
|
+
echo "Tag ${GITHUB_REF_NAME} does not match package version ${version}" >&2
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
- name: Tagged commit must be on develop
|
|
39
|
+
run: |
|
|
40
|
+
git fetch --no-tags origin develop
|
|
41
|
+
git merge-base --is-ancestor "$GITHUB_SHA" origin/develop
|
|
42
|
+
- name: Already on PyPI? (e.g. published locally with scripts/publish.py)
|
|
43
|
+
id: pypi
|
|
44
|
+
run: |
|
|
45
|
+
code=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/devkitx/${GITHUB_REF_NAME#v}/json")
|
|
46
|
+
if [ "$code" = "200" ]; then echo "exists=true" >> "$GITHUB_OUTPUT"; else echo "exists=false" >> "$GITHUB_OUTPUT"; fi
|
|
47
|
+
echo "PyPI lookup for ${GITHUB_REF_NAME#v}: HTTP $code"
|
|
48
|
+
- name: Lint, types and tests
|
|
49
|
+
run: |
|
|
50
|
+
ruff check src tests
|
|
51
|
+
mypy src/devkitx
|
|
52
|
+
pytest -q --cov-fail-under=55
|
|
53
|
+
- name: Build
|
|
54
|
+
run: python -m build
|
|
55
|
+
- name: twine check
|
|
56
|
+
run: twine check --strict dist/*
|
|
57
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
58
|
+
with:
|
|
59
|
+
name: dist
|
|
60
|
+
path: dist/
|
|
61
|
+
if-no-files-found: error
|
|
62
|
+
|
|
63
|
+
publish:
|
|
64
|
+
name: Publish to PyPI
|
|
65
|
+
needs: build
|
|
66
|
+
if: needs.build.outputs.already-published != 'true'
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
environment:
|
|
69
|
+
name: pypi
|
|
70
|
+
url: https://pypi.org/project/devkitx/
|
|
71
|
+
permissions:
|
|
72
|
+
id-token: write
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
75
|
+
with:
|
|
76
|
+
name: dist
|
|
77
|
+
path: dist/
|
|
78
|
+
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
79
|
+
|
|
80
|
+
github-release:
|
|
81
|
+
name: GitHub release
|
|
82
|
+
needs: [build, publish]
|
|
83
|
+
# Runs after a CI publish, or when the version was already published locally.
|
|
84
|
+
if: ${{ !failure() && !cancelled() }}
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
permissions:
|
|
87
|
+
contents: write
|
|
88
|
+
steps:
|
|
89
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
90
|
+
with:
|
|
91
|
+
name: dist
|
|
92
|
+
path: dist/
|
|
93
|
+
- name: Create release with the published files
|
|
94
|
+
env:
|
|
95
|
+
GH_TOKEN: ${{ github.token }}
|
|
96
|
+
run: |
|
|
97
|
+
gh release create "$GITHUB_REF_NAME" dist/* \
|
|
98
|
+
--repo "$GITHUB_REPOSITORY" \
|
|
99
|
+
--title "$GITHUB_REF_NAME" \
|
|
100
|
+
--notes "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/develop/CHANGELOG.md). Published to https://pypi.org/project/devkitx/${GITHUB_REF_NAME#v}/"
|
|
@@ -1,54 +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/
|
|
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/
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.1.0] - 2026-11-17
|
|
9
|
+
|
|
10
|
+
### Security
|
|
11
|
+
- `sanitize_html` with `allowed_tags` no longer passes attributes through. Allowed
|
|
12
|
+
tags are rebuilt from a parse with no attributes unless listed in the new
|
|
13
|
+
`allowed_attributes` argument; `on*`, `style` and `srcdoc` are always removed and
|
|
14
|
+
URL attributes only keep relative, `http`, `https` and `mailto` URLs. Previously
|
|
15
|
+
`<b onmouseover=...>` and `<a href="javascript:...">` survived (XSS).
|
|
16
|
+
Tags such as `script`, `iframe` and `svg` can no longer be allowlisted.
|
|
17
|
+
- Audit log chain hashes now cover each event's full content (previously only the
|
|
18
|
+
event ID and timestamp, so actor, action, outcome and metadata could be edited
|
|
19
|
+
undetected). Optional `hmac_key` makes the chain keyed (HMAC-SHA256). New
|
|
20
|
+
`verify_chain()` and `AuditChainError`. File logs continue their chain after a
|
|
21
|
+
restart, and logging is thread-safe.
|
|
22
|
+
- `secure_hash` only accepts SHA-2, SHA-3 and BLAKE2; `md5` and `sha1` raise
|
|
23
|
+
`ValueError`.
|
|
24
|
+
- `sanitize_filename` also removes control characters (including NUL), avoids
|
|
25
|
+
Windows device names (`CON`, `NUL`, ...) and limits names to 255 bytes. Now
|
|
26
|
+
exported from `devkitx.security`.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- `asyncbridge`, `httpx-defaults` and `configmerge` are now part of devkitx
|
|
30
|
+
(`devkitx.async_bridge`, `devkitx.http_client`, `devkitx.config`). The only
|
|
31
|
+
runtime dependency is `httpx`. New extras: `yaml`, `toml`, `http2`.
|
|
32
|
+
- Line endings normalized to LF.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- README told users to `pip install confmerge`, an unrelated third-party package.
|
|
36
|
+
- `SecureClient.request()` crashed when given an `httpx.URL` object instead of a string.
|
|
37
|
+
- Plain-HTTP warning now checks the parsed host (so `http://localhost.evil.com`
|
|
38
|
+
warns) and also fires for `SecureAsyncClient`, which never warned before.
|
|
39
|
+
- PII detector missed the opening parenthesis of numbers like `(555) 987-6543`;
|
|
40
|
+
the email pattern accepted `|` in the top-level domain.
|
|
41
|
+
- Config files whose top level is not a mapping now raise `ValueError` instead of
|
|
42
|
+
returning a non-dict.
|
|
43
|
+
- `bcrypt` (needed for `hash_password`/`verify_password`) is now declared as the
|
|
44
|
+
`crypto` extra and included in `all`.
|
|
45
|
+
- `devkitx audit deps` runs pip-audit via the current interpreter instead of
|
|
46
|
+
resolving `pip-audit` from `PATH`.
|
|
47
|
+
- Project URLs pointed at a `SerityOps/devkitx` repository and a Read the Docs
|
|
48
|
+
site that do not exist; they now point at `ladycami/devkitx`.
|
|
49
|
+
|
|
50
|
+
### Internal
|
|
51
|
+
- Releases: pushing a `vX.Y.Z` tag publishes to PyPI from CI via trusted
|
|
52
|
+
publishing (`.github/workflows/release.yml`); `scripts/publish.py` publishes
|
|
53
|
+
locally using tokens from a gitignored `.env` (format in `.env.example`).
|
|
54
|
+
- CI runs on `develop` and pull requests (the old workflow targeted a `main`
|
|
55
|
+
branch that does not exist): ruff, ruff format, strict mypy on 3.10 and 3.13
|
|
56
|
+
semantics, tests on Python 3.10-3.13 with a coverage floor, doctests, bandit,
|
|
57
|
+
pip-audit, and a build + clean-install check. Actions are pinned by commit SHA.
|
|
58
|
+
- ruff and mypy (strict) are clean; ruff's security rules (`S`) are enabled.
|
|
59
|
+
|
|
60
|
+
## [2.0.1] - 2025-12-31
|
|
61
|
+
|
|
62
|
+
Source restored from the PyPI release; no separate changelog was kept for 2.0.x.
|
|
63
|
+
|
|
64
|
+
## [2.0.0] - 2025-12-31
|
|
65
|
+
|
|
66
|
+
Security- and compliance-focused rewrite: audit logging, PII detection, secrets
|
|
67
|
+
scanning, input sanitization, NIST 800-53 control mapping and a Typer CLI.
|
|
68
|
+
|
|
69
|
+
## [1.0.1] - 2025-09-16
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
- Finalized rename to `devkitx` across package, imports, docs, and URLs
|
|
73
|
+
- Marked package Development Status: Beta (instead of Production/Stable)
|
|
74
|
+
- Curated top-level exports; added `py.typed` marker file
|
|
75
|
+
- Updated project URLs to point to correct `ladycami/devkitx` repository
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
- HTTP clients with sensible defaults (10s connect, 15s read timeouts)
|
|
79
|
+
- Retry helper with exponential backoff and jitter
|
|
80
|
+
- Async bridges for safe sync/async conversion with event loop detection
|
|
81
|
+
- Concurrency limiter for async operations using semaphores
|
|
82
|
+
- JWT utilities with safe defaults (HS256, required exp/iat claims)
|
|
83
|
+
- JSON flattening utility for nested structures
|
|
84
|
+
- Minimal test suite with CI pipeline (ruff, mypy, pytest)
|
|
85
|
+
- Optional dependency extras: http, cli, jwt, bcrypt, yaml, toml, dev
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
- Import/package name mismatches in documentation and examples
|
|
89
|
+
- Incorrect project links in PyPI metadata
|
|
90
|
+
- Missing type annotation marker file
|
|
91
|
+
- Package structure to follow Python best practices
|
|
92
|
+
|
|
93
|
+
## [1.0.0] - 2025-09-15
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
- Initial release of DevKitX
|
|
97
|
+
- 16 comprehensive utility modules:
|
|
98
|
+
- `string_utils`: Case conversions, validation, sanitization
|
|
99
|
+
- `json_utils`: JSON processing, flatten/unflatten, pretty printing
|
|
100
|
+
- `file_utils`: Atomic writes, file finding, cross-platform operations
|
|
101
|
+
- `data_utils`: Deep merge/diff, collection processing, transformations
|
|
102
|
+
- `config_utils`: Multi-format config loading, type-safe getters
|
|
103
|
+
- `system_utils`: System info, command execution, process management
|
|
104
|
+
- `security_utils`: Password hashing, JWT tokens, secure generation
|
|
105
|
+
- `time_utils`: Date parsing, timezone handling, business days
|
|
106
|
+
- `validation_utils`: Schema validation, input validation, custom rules
|
|
107
|
+
- `cli_utils`: Interactive prompts, progress bars, colored output
|
|
108
|
+
- `http_utils`: API clients, retry logic, async support
|
|
109
|
+
- `async_utils`: Async file ops, sync/async bridges, concurrency
|
|
110
|
+
- `dev_utils`: Performance profiling, debugging, test data generation
|
|
111
|
+
- `log_utils`: Enhanced logging setup, timing contexts
|
|
112
|
+
- 200+ utility functions with comprehensive type annotations
|
|
113
|
+
- 50+ CLI commands across 8 categories
|
|
114
|
+
- Comprehensive test suite with 89% coverage (740+ test cases)
|
|
115
|
+
- Cross-platform compatibility (Windows, macOS, Linux)
|
|
116
|
+
- Async/await support throughout
|
|
117
|
+
- Security best practices with bcrypt and JWT
|
|
118
|
+
- Performance optimizations and benchmarking tools
|
|
119
|
+
|
|
120
|
+
### Security
|
|
121
|
+
- Secure password hashing using bcrypt
|
|
122
|
+
- JWT token generation and verification
|
|
123
|
+
- Input sanitization and validation
|
|
124
|
+
- Cryptographically secure random generation
|
|
125
|
+
|
|
126
|
+
### Documentation
|
|
127
|
+
- Complete API documentation with examples
|
|
128
|
+
- Comprehensive README with usage examples
|
|
129
|
+
- Real-world usage scenarios and demos
|
|
130
|
+
- CLI command documentation
|
|
131
|
+
|
|
132
|
+
## [1.0.1] - 2025-09-16
|
|
133
|
+
|
|
134
|
+
### Changed
|
|
135
|
+
- Finalized rename to `devkitx` across package, imports, docs, and URLs
|
|
136
|
+
- Updated package development status from "Production/Stable" to "Beta"
|
|
137
|
+
- Curated top-level exports with graceful handling of optional dependencies
|
|
138
|
+
- Added `py.typed` marker file for proper type annotation support
|
|
139
|
+
|
|
140
|
+
### Added
|
|
141
|
+
- HTTP clients with sensible defaults (10s connect, 15s read timeouts)
|
|
142
|
+
- Connection limits to prevent resource exhaustion (10 keepalive, 100 total)
|
|
143
|
+
- Retry helper with exponential backoff and jitter
|
|
144
|
+
- Async bridge functions for safe sync/async conversion with event loop detection
|
|
145
|
+
- Async concurrency limiter using semaphore-based control
|
|
146
|
+
- JSON flattening utility with configurable separators
|
|
147
|
+
- JWT utilities with secure defaults (HS256, required exp/iat claims)
|
|
148
|
+
- Optional dependency groups (extras): http, cli, jwt, bcrypt, yaml, toml
|
|
149
|
+
- Minimal test suite with CI/CD pipeline (ruff, mypy, pytest)
|
|
150
|
+
- Security documentation with clear scope and limitations
|
|
151
|
+
|
|
152
|
+
### Fixed
|
|
153
|
+
- Import/package name mismatches - all examples now use correct `devkitx` imports
|
|
154
|
+
- Project URLs now point to correct `ladycami/devkitx` repository
|
|
155
|
+
- Changelog entries now have proper dates instead of "Upcoming" status
|
|
156
|
+
- Package structure follows Python packaging best practices
|
|
157
|
+
|
|
158
|
+
### Security
|
|
159
|
+
- JWT tokens now require exp and iat claims by default
|
|
160
|
+
- HTTP clients use secure connection limits to prevent resource exhaustion
|
|
161
|
+
- Clear documentation of security feature scope and limitations
|
|
162
|
+
|
|
163
|
+
## [Unreleased]
|
|
164
|
+
|
|
165
|
+
### Planned for v1.1.0
|
|
166
|
+
- Enhanced property-based testing with Hypothesis
|
|
167
|
+
- Additional timeout and retry configurations
|
|
168
|
+
- Expanded async utilities and concurrency helpers
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Security Policy
|
|
173
|
+
|
|
174
|
+
If you discover a security vulnerability, please send an email to the maintainers. All security vulnerabilities will be promptly addressed.
|
|
175
|
+
|
|
176
|
+
## Migration Guide
|
|
177
|
+
|
|
178
|
+
### From v0.x to v1.0.0
|
|
179
|
+
This is the initial stable release. No migration needed.
|
|
180
|
+
|
|
181
|
+
### Future Migrations
|
|
182
|
+
Breaking changes will be clearly documented here with migration instructions.
|
devkitx-2.1.0/LICENSE
ADDED
|
File without changes
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: devkitx
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Security-first Python utilities for government, healthcare, and financial applications.
|
|
5
|
-
Project-URL: Homepage, https://github.com/
|
|
6
|
-
Project-URL: Documentation, https://devkitx
|
|
7
|
-
Project-URL: Repository, https://github.com/
|
|
8
|
-
Project-URL: Issues, https://github.com/
|
|
5
|
+
Project-URL: Homepage, https://github.com/ladycami/devkitx
|
|
6
|
+
Project-URL: Documentation, https://github.com/ladycami/devkitx#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/ladycami/devkitx
|
|
8
|
+
Project-URL: Issues, https://github.com/ladycami/devkitx/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/ladycami/devkitx/blob/develop/CHANGELOG.md
|
|
9
10
|
Author: LadyCami
|
|
10
11
|
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
11
13
|
Keywords: audit,compliance,fedramp,hipaa,nist,pii,secrets,security,soc2,utilities
|
|
12
14
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
15
|
Classifier: Intended Audience :: Developers
|
|
@@ -20,26 +22,46 @@ Classifier: Topic :: Security
|
|
|
20
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
23
|
Classifier: Typing :: Typed
|
|
22
24
|
Requires-Python: >=3.10
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist: configmerge>=1.0.0
|
|
25
|
-
Requires-Dist: httpx-defaults>=1.0.0
|
|
25
|
+
Requires-Dist: httpx>=0.25.0
|
|
26
26
|
Provides-Extra: all
|
|
27
|
+
Requires-Dist: bcrypt>=4.1; extra == 'all'
|
|
28
|
+
Requires-Dist: h2>=4.0.0; extra == 'all'
|
|
29
|
+
Requires-Dist: pyyaml>=6.0; extra == 'all'
|
|
27
30
|
Requires-Dist: rich>=13.0.0; extra == 'all'
|
|
28
31
|
Requires-Dist: structlog>=23.0.0; extra == 'all'
|
|
32
|
+
Requires-Dist: tomli>=2.0; (python_version < '3.11') and extra == 'all'
|
|
29
33
|
Requires-Dist: typer>=0.9.0; extra == 'all'
|
|
30
34
|
Provides-Extra: audit
|
|
31
35
|
Requires-Dist: structlog>=23.0.0; extra == 'audit'
|
|
32
36
|
Provides-Extra: cli
|
|
33
37
|
Requires-Dist: rich>=13.0.0; extra == 'cli'
|
|
34
38
|
Requires-Dist: typer>=0.9.0; extra == 'cli'
|
|
39
|
+
Provides-Extra: crypto
|
|
40
|
+
Requires-Dist: bcrypt>=4.1; extra == 'crypto'
|
|
35
41
|
Provides-Extra: dev
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist:
|
|
42
|
+
Requires-Dist: bandit>=1.7; extra == 'dev'
|
|
43
|
+
Requires-Dist: bcrypt>=4.1; extra == 'dev'
|
|
44
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
45
|
+
Requires-Dist: h2>=4.0.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
47
|
+
Requires-Dist: pip-audit>=2.7; extra == 'dev'
|
|
48
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
50
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
51
|
+
Requires-Dist: pyyaml>=6.0; extra == 'dev'
|
|
39
52
|
Requires-Dist: rich>=13.0.0; extra == 'dev'
|
|
40
|
-
Requires-Dist: ruff>=0.
|
|
53
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
41
54
|
Requires-Dist: structlog>=23.0.0; extra == 'dev'
|
|
55
|
+
Requires-Dist: tomli>=2.0; (python_version < '3.11') and extra == 'dev'
|
|
56
|
+
Requires-Dist: twine>=5.1; extra == 'dev'
|
|
42
57
|
Requires-Dist: typer>=0.9.0; extra == 'dev'
|
|
58
|
+
Requires-Dist: types-pyyaml; extra == 'dev'
|
|
59
|
+
Provides-Extra: http2
|
|
60
|
+
Requires-Dist: h2>=4.0.0; extra == 'http2'
|
|
61
|
+
Provides-Extra: toml
|
|
62
|
+
Requires-Dist: tomli>=2.0; (python_version < '3.11') and extra == 'toml'
|
|
63
|
+
Provides-Extra: yaml
|
|
64
|
+
Requires-Dist: pyyaml>=6.0; extra == 'yaml'
|
|
43
65
|
Description-Content-Type: text/markdown
|
|
44
66
|
|
|
45
67
|
# DevKitX
|
|
@@ -94,16 +116,6 @@ if matches:
|
|
|
94
116
|
raise ValueError(f"PII detected: {[m.pii_type for m in matches]}")
|
|
95
117
|
```
|
|
96
118
|
|
|
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
119
|
## Compliance Mapping
|
|
108
120
|
|
|
109
121
|
DevKitX features map to common compliance frameworks:
|
|
@@ -130,19 +142,19 @@ pip install devkitx[cli]
|
|
|
130
142
|
pip install devkitx[all]
|
|
131
143
|
```
|
|
132
144
|
|
|
133
|
-
###
|
|
145
|
+
### Optional extras
|
|
134
146
|
|
|
135
147
|
```bash
|
|
136
|
-
#
|
|
137
|
-
pip install
|
|
138
|
-
|
|
139
|
-
# Production HTTP client with secure defaults
|
|
140
|
-
pip install httpx-defaults
|
|
141
|
-
|
|
142
|
-
# Multi-format config loading
|
|
143
|
-
pip install confmerge
|
|
148
|
+
pip install devkitx[yaml] # YAML config files
|
|
149
|
+
pip install devkitx[toml] # TOML config files on Python 3.10
|
|
150
|
+
pip install devkitx[http2] # HTTP/2 support for SecureClient
|
|
144
151
|
```
|
|
145
152
|
|
|
153
|
+
The async/sync bridge, secure HTTP client and config loader that used to ship
|
|
154
|
+
as the separate `asyncbridge`, `httpx-defaults` and `configmerge` packages are
|
|
155
|
+
now part of devkitx (`devkitx.async_bridge`, `devkitx.http_client`,
|
|
156
|
+
`devkitx.config`).
|
|
157
|
+
|
|
146
158
|
## Features
|
|
147
159
|
|
|
148
160
|
### 🔒 Security & Compliance
|
|
@@ -227,6 +239,24 @@ logger.log_change(
|
|
|
227
239
|
)
|
|
228
240
|
```
|
|
229
241
|
|
|
242
|
+
#### Tamper evidence (AU-9)
|
|
243
|
+
|
|
244
|
+
Every event carries a hash that chains it to the previous one and covers its
|
|
245
|
+
full content. Pass a secret key, kept outside the log, so the chain can't be
|
|
246
|
+
recomputed by someone who edits the file:
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
import os
|
|
250
|
+
from pathlib import Path
|
|
251
|
+
from devkitx.compliance import AuditLogger, verify_chain
|
|
252
|
+
|
|
253
|
+
key = os.environ["AUDIT_HMAC_KEY"].encode()
|
|
254
|
+
logger = AuditLogger(service="user-api", output=Path("audit.log"), hmac_key=key)
|
|
255
|
+
logger.log_auth(action="login", user_id="user123")
|
|
256
|
+
|
|
257
|
+
verify_chain(Path("audit.log"), hmac_key=key) # raises AuditChainError if altered
|
|
258
|
+
```
|
|
259
|
+
|
|
230
260
|
### Security Scanning
|
|
231
261
|
|
|
232
262
|
```python
|
|
@@ -313,7 +343,7 @@ DevKitX helps implement several NIST 800-53 security controls:
|
|
|
313
343
|
|
|
314
344
|
- **AU-2 (Audit Events)**: AuditLogger identifies auditable events
|
|
315
345
|
- **AU-3 (Content of Audit Records)**: Structured logging with required fields
|
|
316
|
-
- **AU-9 (Protection of Audit Information)**:
|
|
346
|
+
- **AU-9 (Protection of Audit Information)**: Hash-chained audit events, keyed with HMAC-SHA256 when `hmac_key` is set; verify with `verify_chain()`
|
|
317
347
|
- **SA-3 (System Development Life Cycle)**: Security scanning in development
|
|
318
348
|
- **SC-8 (Transmission Confidentiality)**: Secure HTTP defaults
|
|
319
349
|
- **SC-28 (Protection of Information at Rest)**: Secret detection
|
|
@@ -337,7 +367,20 @@ DevKitX helps implement several NIST 800-53 security controls:
|
|
|
337
367
|
## Requirements
|
|
338
368
|
|
|
339
369
|
- Python 3.10+
|
|
340
|
-
- Core
|
|
370
|
+
- Core dependency: httpx
|
|
371
|
+
|
|
372
|
+
## Releasing
|
|
373
|
+
|
|
374
|
+
1. Merge the release changes to `develop` (version in `pyproject.toml` and
|
|
375
|
+
`src/devkitx/_version.py`, dated entry in `CHANGELOG.md`).
|
|
376
|
+
2. Tag the merge commit and push the tag: `git tag -a v2.1.0 -m v2.1.0 && git push origin v2.1.0`.
|
|
377
|
+
3. CI (`.github/workflows/release.yml`) re-runs the checks, publishes to PyPI with
|
|
378
|
+
trusted publishing (no token stored anywhere) and creates the GitHub release.
|
|
379
|
+
|
|
380
|
+
To publish from your machine instead, put tokens in a local `.env` (copy
|
|
381
|
+
`.env.example`; it is gitignored and must never be committed) and run
|
|
382
|
+
`python scripts/publish.py --test` for TestPyPI or `python scripts/publish.py`
|
|
383
|
+
for PyPI. Use `--dry-run` to build and check without uploading.
|
|
341
384
|
|
|
342
385
|
## License
|
|
343
386
|
|