agent-guard-kit-sdk 0.1.0a3__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.
- agent_guard_kit_sdk-0.1.0a3/.github/workflows/ci.yml +84 -0
- agent_guard_kit_sdk-0.1.0a3/.github/workflows/publish.yml +224 -0
- agent_guard_kit_sdk-0.1.0a3/.gitignore +37 -0
- agent_guard_kit_sdk-0.1.0a3/CHANGELOG.md +64 -0
- agent_guard_kit_sdk-0.1.0a3/CONTRIBUTING.md +61 -0
- agent_guard_kit_sdk-0.1.0a3/LICENSE +13 -0
- agent_guard_kit_sdk-0.1.0a3/PKG-INFO +220 -0
- agent_guard_kit_sdk-0.1.0a3/README.md +186 -0
- agent_guard_kit_sdk-0.1.0a3/SECURITY.md +56 -0
- agent_guard_kit_sdk-0.1.0a3/docs/ARCHITECTURE.md +66 -0
- agent_guard_kit_sdk-0.1.0a3/docs/THREAT_MODEL.md +28 -0
- agent_guard_kit_sdk-0.1.0a3/examples/01_basic_mock_quickstart.py +73 -0
- agent_guard_kit_sdk-0.1.0a3/examples/02_agent_capability_policy.py +52 -0
- agent_guard_kit_sdk-0.1.0a3/examples/03_vault_kv2_production.py +31 -0
- agent_guard_kit_sdk-0.1.0a3/examples/04_mcp_tool_broker.py +108 -0
- agent_guard_kit_sdk-0.1.0a3/pyproject.toml +80 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/__init__.py +92 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/audit/__init__.py +17 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/audit/sanitizer.py +243 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/broker.py +776 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/exceptions.py +216 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/interfaces.py +177 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/metadata/__init__.py +11 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/metadata/base.py +93 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/metadata/memory.py +91 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/path.py +62 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/policy.py +358 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/py.typed +1 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/storage/__init__.py +11 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/storage/base.py +50 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/storage/kv2.py +433 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/storage/memory.py +186 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/testing/__init__.py +5 -0
- agent_guard_kit_sdk-0.1.0a3/src/agentguardkit/testing/mock_vault.py +5 -0
- agent_guard_kit_sdk-0.1.0a3/tests/conftest.py +99 -0
- agent_guard_kit_sdk-0.1.0a3/tests/integration/test_broker_lifecycle.py +87 -0
- agent_guard_kit_sdk-0.1.0a3/tests/integration/test_concurrency_cas.py +86 -0
- agent_guard_kit_sdk-0.1.0a3/tests/integration/test_security_negative.py +205 -0
- agent_guard_kit_sdk-0.1.0a3/tests/integration/test_two_phase_rollback.py +146 -0
- agent_guard_kit_sdk-0.1.0a3/tests/unit/test_audit_sanitizer.py +213 -0
- agent_guard_kit_sdk-0.1.0a3/tests/unit/test_broker_extended.py +224 -0
- agent_guard_kit_sdk-0.1.0a3/tests/unit/test_interfaces.py +141 -0
- agent_guard_kit_sdk-0.1.0a3/tests/unit/test_kv2_storage.py +323 -0
- agent_guard_kit_sdk-0.1.0a3/tests/unit/test_mock_storage.py +122 -0
- agent_guard_kit_sdk-0.1.0a3/tests/unit/test_path.py +68 -0
- agent_guard_kit_sdk-0.1.0a3/tests/unit/test_policy.py +402 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, "fix/*" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: Test on Python ${{ matrix.python-version }} (${{ matrix.os }})
|
|
15
|
+
runs-on: ${{ matrix.os }}
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
os: [ubuntu-latest, windows-latest]
|
|
20
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout code
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python-version }}
|
|
30
|
+
cache: "pip"
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: |
|
|
34
|
+
python -m pip install --upgrade pip
|
|
35
|
+
pip install -e ".[dev]"
|
|
36
|
+
|
|
37
|
+
- name: Run Ruff Linter & Formatter Check
|
|
38
|
+
run: |
|
|
39
|
+
ruff check .
|
|
40
|
+
ruff format --check .
|
|
41
|
+
|
|
42
|
+
- name: Run Mypy Type Checker
|
|
43
|
+
run: |
|
|
44
|
+
mypy src/agentguardkit
|
|
45
|
+
|
|
46
|
+
- name: Run Pytest Suite with Coverage
|
|
47
|
+
run: |
|
|
48
|
+
pytest --cov=agentguardkit --cov-report=term-missing --cov-fail-under=90
|
|
49
|
+
|
|
50
|
+
- name: Run Secret Scan
|
|
51
|
+
run: |
|
|
52
|
+
python -c "
|
|
53
|
+
import os, re, sys
|
|
54
|
+
PATTERNS = [
|
|
55
|
+
re.compile(r'(?i)(password|secret_key|private_key|api_key|access_token)\s*=\s*[\x27\x22][^\x27\x22]{8,}[\x27\x22]'),
|
|
56
|
+
re.compile(r'AKIA[0-9A-Z]{16}'),
|
|
57
|
+
re.compile(r'ghp_[A-Za-z0-9_]{36}'),
|
|
58
|
+
re.compile(r'-----BEGIN (?:RSA )?PRIVATE KEY-----'),
|
|
59
|
+
]
|
|
60
|
+
findings = []
|
|
61
|
+
for root, dirs, files in os.walk('.'):
|
|
62
|
+
if any(p in root for p in ['.git', '.venv', '__pycache__', 'dist']):
|
|
63
|
+
continue
|
|
64
|
+
for f in files:
|
|
65
|
+
if f.endswith(('.py', '.md', '.toml', '.yml', '.yaml')):
|
|
66
|
+
path = os.path.join(root, f)
|
|
67
|
+
with open(path, 'r', encoding='utf-8', errors='ignore') as h:
|
|
68
|
+
for idx, line in enumerate(h, 1):
|
|
69
|
+
for pat in PATTERNS:
|
|
70
|
+
if pat.search(line):
|
|
71
|
+
if 'REDACTED' in line or 'SYNTHETIC' in line or 'synthetic' in line:
|
|
72
|
+
continue
|
|
73
|
+
findings.append((path, idx, line.strip()))
|
|
74
|
+
if findings:
|
|
75
|
+
print('Potential secrets detected:', file=sys.stderr)
|
|
76
|
+
for p, idx, l in findings:
|
|
77
|
+
print(f'{p}:{idx}: {l}', file=sys.stderr)
|
|
78
|
+
sys.exit(1)
|
|
79
|
+
print('Secret scan passed: 0 leaks found.')
|
|
80
|
+
"
|
|
81
|
+
|
|
82
|
+
- name: Build Package Distribution
|
|
83
|
+
run: |
|
|
84
|
+
python -m build
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
name: Publish Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
target:
|
|
7
|
+
description: 'Target index: "testpypi" or "pypi"'
|
|
8
|
+
required: true
|
|
9
|
+
default: 'testpypi'
|
|
10
|
+
type: choice
|
|
11
|
+
options:
|
|
12
|
+
- testpypi
|
|
13
|
+
- pypi
|
|
14
|
+
version_tag:
|
|
15
|
+
description: 'Release version tag matching pyproject.toml (e.g. v0.1.0a3)'
|
|
16
|
+
required: true
|
|
17
|
+
type: string
|
|
18
|
+
confirm_release:
|
|
19
|
+
description: 'Type "CONFIRM_RELEASE" to authorize execution'
|
|
20
|
+
required: true
|
|
21
|
+
type: string
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
|
|
26
|
+
jobs:
|
|
27
|
+
# =========================================================================
|
|
28
|
+
# Stage 1: Build, Verify & Validate Inputs (Quality & Security Gate)
|
|
29
|
+
# =========================================================================
|
|
30
|
+
build-and-verify:
|
|
31
|
+
name: Build & Verify Release Candidate
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- name: Checkout repository
|
|
35
|
+
uses: actions/checkout@v4
|
|
36
|
+
with:
|
|
37
|
+
fetch-depth: 0
|
|
38
|
+
|
|
39
|
+
- name: Set up Python
|
|
40
|
+
uses: actions/setup-python@v5
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.11"
|
|
43
|
+
cache: "pip"
|
|
44
|
+
|
|
45
|
+
- name: Validate Release Inputs & Tagged Commit
|
|
46
|
+
env:
|
|
47
|
+
CONFIRM_RELEASE: ${{ github.event.inputs.confirm_release }}
|
|
48
|
+
INPUT_TAG: ${{ github.event.inputs.version_tag }}
|
|
49
|
+
INPUT_TARGET: ${{ github.event.inputs.target }}
|
|
50
|
+
run: |
|
|
51
|
+
# 1. Validate confirmation keyword
|
|
52
|
+
if [ "${CONFIRM_RELEASE}" != "CONFIRM_RELEASE" ]; then
|
|
53
|
+
echo "ERROR: Confirmation keyword does not match 'CONFIRM_RELEASE'." >&2
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# 2. Extract canonical version from pyproject.toml on main
|
|
58
|
+
PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
|
|
59
|
+
EXPECTED_TAG="v${PROJECT_VERSION}"
|
|
60
|
+
|
|
61
|
+
echo "pyproject.toml version: ${PROJECT_VERSION}"
|
|
62
|
+
echo "Expected tag: ${EXPECTED_TAG}"
|
|
63
|
+
echo "Provided tag: ${INPUT_TAG}"
|
|
64
|
+
|
|
65
|
+
# 3. Verify tag matches pyproject.toml version exactly
|
|
66
|
+
if [ "${INPUT_TAG}" != "${EXPECTED_TAG}" ]; then
|
|
67
|
+
echo "ERROR: Provided version tag '${INPUT_TAG}' does not match pyproject.toml version '${EXPECTED_TAG}'." >&2
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# 4. Verify tag adheres to approved semver release pattern
|
|
72
|
+
if ! [[ "${INPUT_TAG}" =~ ^v0\.[0-9]+\.[0-9]+(a[0-9]+|b[0-9]+|rc[0-9]+)?$ ]]; then
|
|
73
|
+
echo "ERROR: Tag '${INPUT_TAG}' is not an authorized semver release pattern." >&2
|
|
74
|
+
exit 1
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# 5. Fetch all remote tags and origin/main to ensure accurate ref verification
|
|
78
|
+
git fetch origin main --tags
|
|
79
|
+
|
|
80
|
+
# 6. Verify that the release tag actually exists in the repository
|
|
81
|
+
if ! git rev-parse -q --verify "refs/tags/${INPUT_TAG}" >/dev/null; then
|
|
82
|
+
echo "ERROR: Release tag '${INPUT_TAG}' does not exist in repository." >&2
|
|
83
|
+
exit 1
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# 7. Verify that the tag resolves to the approved main commit
|
|
87
|
+
TAG_COMMIT=$(git rev-parse "refs/tags/${INPUT_TAG}^{commit}")
|
|
88
|
+
MAIN_COMMIT=$(git rev-parse "refs/remotes/origin/main^{commit}")
|
|
89
|
+
|
|
90
|
+
echo "Tag commit: ${TAG_COMMIT}"
|
|
91
|
+
echo "Main commit: ${MAIN_COMMIT}"
|
|
92
|
+
|
|
93
|
+
if [ "${TAG_COMMIT}" != "${MAIN_COMMIT}" ]; then
|
|
94
|
+
echo "ERROR: Tag '${INPUT_TAG}' (${TAG_COMMIT}) does not resolve to approved main commit (${MAIN_COMMIT})." >&2
|
|
95
|
+
exit 1
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
echo "Release inputs, tag existence, and commit alignment verified successfully."
|
|
99
|
+
|
|
100
|
+
- name: Checkout Verified Tagged Commit
|
|
101
|
+
env:
|
|
102
|
+
INPUT_TAG: ${{ github.event.inputs.version_tag }}
|
|
103
|
+
run: |
|
|
104
|
+
git checkout "${INPUT_TAG}"
|
|
105
|
+
echo "Checked out verified tag commit: $(git rev-parse HEAD)"
|
|
106
|
+
|
|
107
|
+
- name: Install package and consistent dev dependencies
|
|
108
|
+
run: |
|
|
109
|
+
python -m pip install --upgrade pip
|
|
110
|
+
pip install -e ".[dev]"
|
|
111
|
+
pip install twine
|
|
112
|
+
|
|
113
|
+
- name: Run Ruff Linter & Formatter Check
|
|
114
|
+
run: |
|
|
115
|
+
ruff check .
|
|
116
|
+
ruff format --check .
|
|
117
|
+
|
|
118
|
+
- name: Run Mypy Strict Type Check
|
|
119
|
+
run: |
|
|
120
|
+
mypy src/agentguardkit
|
|
121
|
+
|
|
122
|
+
- name: Run Pytest Suite with Coverage (>= 90%)
|
|
123
|
+
run: |
|
|
124
|
+
pytest --cov=agentguardkit --cov-fail-under=90
|
|
125
|
+
|
|
126
|
+
- name: Run Secret Scan
|
|
127
|
+
run: |
|
|
128
|
+
python -c "
|
|
129
|
+
import os, re, sys
|
|
130
|
+
PATTERNS = [
|
|
131
|
+
re.compile(r'(?i)(password|secret_key|private_key|api_key|access_token)\s*=\s*[\x27\x22][^\x27\x22]{8,}[\x27\x22]'),
|
|
132
|
+
re.compile(r'AKIA[0-9A-Z]{16}'),
|
|
133
|
+
re.compile(r'ghp_[A-Za-z0-9_]{36}'),
|
|
134
|
+
re.compile(r'-----BEGIN (?:RSA )?PRIVATE KEY-----'),
|
|
135
|
+
]
|
|
136
|
+
findings = []
|
|
137
|
+
for root, _, files in os.walk('.'):
|
|
138
|
+
if any(p in root for p in ['.git', '.venv', '__pycache__', 'dist']): continue
|
|
139
|
+
for f in files:
|
|
140
|
+
if f.endswith(('.py', '.md', '.toml', '.yml', '.yaml')):
|
|
141
|
+
with open(os.path.join(root, f), 'r', encoding='utf-8', errors='ignore') as h:
|
|
142
|
+
for idx, line in enumerate(h, 1):
|
|
143
|
+
for pat in PATTERNS:
|
|
144
|
+
if pat.search(line) and not any(k in line for k in ['REDACTED', 'SYNTHETIC', 'synthetic']):
|
|
145
|
+
findings.append((f, idx, line.strip()))
|
|
146
|
+
if findings:
|
|
147
|
+
print('Potential secrets detected:', file=sys.stderr)
|
|
148
|
+
for f, idx, l in findings:
|
|
149
|
+
print(f'{f}:{idx}: {l}', file=sys.stderr)
|
|
150
|
+
sys.exit(1)
|
|
151
|
+
print('Secret scan passed: 0 leaks found.')
|
|
152
|
+
"
|
|
153
|
+
|
|
154
|
+
- name: Build Source and Binary Distributions
|
|
155
|
+
run: python -m build
|
|
156
|
+
|
|
157
|
+
- name: Validate Package Metadata with Twine
|
|
158
|
+
run: twine check --strict dist/*
|
|
159
|
+
|
|
160
|
+
- name: Verify Clean Wheel Installation
|
|
161
|
+
run: |
|
|
162
|
+
python -m venv test_env
|
|
163
|
+
./test_env/bin/pip install dist/*.whl
|
|
164
|
+
./test_env/bin/python -c "import agentguardkit; print('Installed version:', agentguardkit.__version__)"
|
|
165
|
+
|
|
166
|
+
- name: Upload Build Distributions
|
|
167
|
+
uses: actions/upload-artifact@v4
|
|
168
|
+
with:
|
|
169
|
+
name: python-package-distributions
|
|
170
|
+
path: dist/
|
|
171
|
+
retention-days: 1
|
|
172
|
+
|
|
173
|
+
# =========================================================================
|
|
174
|
+
# Stage 2A: Publish to TestPyPI (Isolated Job & Fixed Environment)
|
|
175
|
+
# =========================================================================
|
|
176
|
+
publish-testpypi:
|
|
177
|
+
name: Publish to TestPyPI (Staging)
|
|
178
|
+
needs: [build-and-verify]
|
|
179
|
+
if: ${{ github.event.inputs.target == 'testpypi' }}
|
|
180
|
+
runs-on: ubuntu-latest
|
|
181
|
+
environment:
|
|
182
|
+
name: pypi-test
|
|
183
|
+
url: https://test.pypi.org/p/agent-guard-kit-sdk
|
|
184
|
+
permissions:
|
|
185
|
+
id-token: write # OIDC token permission for TestPyPI trusted publishing
|
|
186
|
+
|
|
187
|
+
steps:
|
|
188
|
+
- name: Download Build Distributions
|
|
189
|
+
uses: actions/download-artifact@v4
|
|
190
|
+
with:
|
|
191
|
+
name: python-package-distributions
|
|
192
|
+
path: dist/
|
|
193
|
+
|
|
194
|
+
- name: Publish to TestPyPI
|
|
195
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
196
|
+
with:
|
|
197
|
+
repository-url: https://test.pypi.org/legacy/
|
|
198
|
+
packages-dir: dist/
|
|
199
|
+
|
|
200
|
+
# =========================================================================
|
|
201
|
+
# Stage 2B: Publish to Production PyPI (Isolated Job & Fixed Environment)
|
|
202
|
+
# =========================================================================
|
|
203
|
+
publish-production:
|
|
204
|
+
name: Publish to Production PyPI
|
|
205
|
+
needs: [build-and-verify]
|
|
206
|
+
if: ${{ github.event.inputs.target == 'pypi' }}
|
|
207
|
+
runs-on: ubuntu-latest
|
|
208
|
+
environment:
|
|
209
|
+
name: pypi-production
|
|
210
|
+
url: https://pypi.org/p/agent-guard-kit-sdk
|
|
211
|
+
permissions:
|
|
212
|
+
id-token: write # OIDC token permission for Production PyPI trusted publishing
|
|
213
|
+
|
|
214
|
+
steps:
|
|
215
|
+
- name: Download Build Distributions
|
|
216
|
+
uses: actions/download-artifact@v4
|
|
217
|
+
with:
|
|
218
|
+
name: python-package-distributions
|
|
219
|
+
path: dist/
|
|
220
|
+
|
|
221
|
+
- name: Publish to Production PyPI
|
|
222
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
223
|
+
with:
|
|
224
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# Testing and coverage
|
|
18
|
+
.coverage
|
|
19
|
+
.pytest_cache/
|
|
20
|
+
htmlcov/
|
|
21
|
+
|
|
22
|
+
# Static typing and linting
|
|
23
|
+
.mypy_cache/
|
|
24
|
+
.ruff_cache/
|
|
25
|
+
|
|
26
|
+
# IDE and OS
|
|
27
|
+
.vscode/
|
|
28
|
+
.idea/
|
|
29
|
+
.DS_Store
|
|
30
|
+
Thumbs.db
|
|
31
|
+
|
|
32
|
+
# Secrets & Environment (Strict defense)
|
|
33
|
+
*.env
|
|
34
|
+
*.pem
|
|
35
|
+
*.key
|
|
36
|
+
*.token
|
|
37
|
+
*.sqlite3
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to AgentGuardKit 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
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0a3] - 2026-11-25
|
|
11
|
+
|
|
12
|
+
> **Experimental Alpha** — Corrected PyPI distribution name to match registered Trusted Publisher project.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- **PyPI Distribution Package Name**: Updated package name from `agentguardkit-sdk` to `agent-guard-kit-sdk` in `pyproject.toml` to match the PyPI project registered under the Trusted Publisher configuration.
|
|
16
|
+
- **Brand & Import Namespace**: Retained the `AgentGuardKit` brand identity, GitHub repository (`techmsd/agent-guard-kit`), and standard Python import namespace (`import agentguardkit`).
|
|
17
|
+
- **Publishing & Documentation**: Updated distribution URLs in `.github/workflows/publish.yml`, `README.md`, and version references for `v0.1.0a3`.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## [0.1.0a2] - 2026-11-25
|
|
22
|
+
|
|
23
|
+
> **Experimental Alpha** — Updated distribution package name for PyPI.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- **PyPI Distribution Package Name**: Updated package name from `agent-guard-kit` to `agentguardkit-sdk` in `pyproject.toml` due to similarity collision with an existing project on PyPI.
|
|
27
|
+
- **Brand & Import Namespace**: Retained the `AgentGuardKit` brand identity, GitHub repository (`techmsd/agent-guard-kit`), and standard Python import namespace (`import agentguardkit`).
|
|
28
|
+
- **Publishing & Documentation**: Updated distribution URLs in `.github/workflows/publish.yml`, `README.md`, and security references for `v0.1.0a2`.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## [0.1.0a1] - 2026-11-25
|
|
33
|
+
|
|
34
|
+
> **Experimental Alpha** — Public API may change before the stable 0.1.0 release.
|
|
35
|
+
> This release has NOT been published to PyPI.
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
- **Core Broker Engine**: Framework-independent `CredentialBroker` managing tenant secret lifecycles across pluggable backends.
|
|
39
|
+
- **Pluggable Storage Protocol**: `SecretStorageBackend` interface with production `HashiCorpVaultKV2Storage` and in-memory `MockVaultStorage`.
|
|
40
|
+
- **Pure Standard Library Vault Adapter**: Lightweight HTTPS client supporting Token and AppRole authentication, TLS verification, CAS preconditions (mapping HTTP 400 and 412), and safe redirect handling.
|
|
41
|
+
- **Tenant Path Derivation & Validation**: Hierarchical path derivation (`tenants/{tenant_id}/connectors/{connector_id}`) rejecting path traversal (`..`), null bytes, and invalid character sequences.
|
|
42
|
+
- **Two-Phase Compensating Rollback**: Version-scoped compensating deletion in storage engines upon metadata persistence failures, preventing orphaned credentials.
|
|
43
|
+
- **Deny-by-Default Policy Engine**: Strict actor role matrix unconditionally denying secret decryption to autonomous AI agents and gating tool execution behind capability proposals.
|
|
44
|
+
- **Strict Typed Audit Sanitizer**: Typed allowlisting and secret scrubbing for telemetry data, preventing credential leakage in logs and traces.
|
|
45
|
+
- **Comprehensive Security Test Suite**: 130 automated tests achieving 92.45% coverage across tenant isolation, CAS conflicts, rollback, fault injection, and policy invariant bypass attempts.
|
|
46
|
+
|
|
47
|
+
### Security Hardening (pre-release, PR #1)
|
|
48
|
+
- **Non-Overridable Policy Invariants**: Custom rules evaluate *after* baseline security rules and can only narrow permissions; they cannot override authentication, tenant boundary, decrypt denial, mutation restriction, or proposal gating checks. `AuthorizationContext.is_authenticated` defaults to `False` (fail-closed).
|
|
49
|
+
- **Complete Rollback Protection**: Every post-write metadata operation (retrieval and persistence) is inside the compensating rollback try block. Rollback failure produces a structured `RollbackRecoveryRecord` and raises `RollbackError` with safe diagnostic codes even if the metadata store is offline.
|
|
50
|
+
- **Secret Leakage Path Elimination**: Raw backend exception strings replaced with stable `diagnostic_code` values (`e.__class__.__name__`). `SecretPayload.__repr__` redacts `secret_value`, hides description text (`has_description`), masks arbitrary non-standard secret types as `'[CUSTOM]'`, and emits only metadata counts (`custom_metadata_count`) without metadata keys or values.
|
|
51
|
+
- **Complete Readiness Authorization**: Tenant readiness queries enforce `READ_METADATA` policy via `PolicyEngine.enforce()`. Read-only actors receive `can_mutate=False`. Explicit handling added for `storage_uninitialized` and `storage_standby` states without exposing raw backend errors.
|
|
52
|
+
- **Vault Response Schema Validation**: Write response validated for positive integer `version >= 1`; fallback assumptions removed. Finite float enforcement for timeout configuration.
|
|
53
|
+
- **Hardened Audit Sanitizer**: Sensitive key terms blocked unconditionally regardless of custom validators. Only valid bounded scalar types survive. Input strings bounded prior to regex pattern scrubbing.
|
|
54
|
+
|
|
55
|
+
### Known Limitations (alpha)
|
|
56
|
+
- No optional framework adapters (Django, FastAPI) yet — planned for 0.2.0.
|
|
57
|
+
- `HashiCorpVaultKV2Storage` does not support Vault namespaces or transit-encrypted fields.
|
|
58
|
+
- External SaaS credential revocation (Stripe, AWS, Google) is out of scope; soft-delete only.
|
|
59
|
+
- AgentGuardKit operates in-process; it is not an OS or container isolation boundary.
|
|
60
|
+
- PyPI publication pending independent security review and stable API confirmation.
|
|
61
|
+
|
|
62
|
+
### Breaking Changes
|
|
63
|
+
- `AuthorizationContext.is_authenticated` now defaults to `False`. Host applications that relied on the previous `True` default must explicitly set `is_authenticated=True` after authenticating the caller.
|
|
64
|
+
- `AuthorizationContext` raises `ValueError` on empty/whitespace `actor_id` and empty `permitted_tenant_ids`/`permitted_connector_ids` collections.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Contributing to AgentGuardKit
|
|
2
|
+
|
|
3
|
+
Thank you for contributing to AgentGuardKit! We welcome issues, documentation improvements, and pull requests that adhere to our security architecture and quality standards.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Code of Conduct & Development Principles
|
|
8
|
+
|
|
9
|
+
1. **Security-First Invariants**:
|
|
10
|
+
Every change must preserve core security invariants: zero plaintext secrets in logs/exceptions, deny-by-default capability policies, and strict tenant isolation.
|
|
11
|
+
2. **Framework Independence**:
|
|
12
|
+
The core package (`agentguardkit`) must retain **zero mandatory third-party runtime dependencies**. All adapters for external frameworks (FastAPI, Django, SQLAlchemy) belong in optional contrib subpackages or example recipes.
|
|
13
|
+
3. **Truthful Documentation**:
|
|
14
|
+
Do not claim features exist unless they are implemented and verified by automated tests.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Development Setup
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Clone the repository
|
|
22
|
+
git clone https://github.com/techmsd/agent-guard-kit.git
|
|
23
|
+
cd agent-guard-kit
|
|
24
|
+
|
|
25
|
+
# Create a virtual environment
|
|
26
|
+
python -m venv .venv
|
|
27
|
+
|
|
28
|
+
# Activate environment (Linux/macOS)
|
|
29
|
+
source .venv/bin/activate
|
|
30
|
+
# Or on Windows (PowerShell)
|
|
31
|
+
.venv\Scripts\Activate.ps1
|
|
32
|
+
|
|
33
|
+
# Install development dependencies
|
|
34
|
+
pip install -e ".[dev]"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Running Verification
|
|
40
|
+
|
|
41
|
+
Before submitting a pull request, run the complete verification suite:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 1. Run tests with coverage (minimum 90% required)
|
|
45
|
+
pytest --cov=agentguardkit --cov-report=term-missing
|
|
46
|
+
|
|
47
|
+
# 2. Run static type checking
|
|
48
|
+
mypy src/agentguardkit
|
|
49
|
+
|
|
50
|
+
# 3. Run linting and formatting checks
|
|
51
|
+
ruff check .
|
|
52
|
+
ruff format --check .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Pull Request Guidelines
|
|
58
|
+
|
|
59
|
+
- Keep pull requests focused on a single logical change or bug fix.
|
|
60
|
+
- Add negative security tests for any new path, policy, or storage handling logic.
|
|
61
|
+
- Ensure all CI workflow checks pass cleanly.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 AgentGuardKit Contributors
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|