compliance-aiops 0.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.
- compliance_aiops-0.1.0/.github/workflows/publish.yml +26 -0
- compliance_aiops-0.1.0/.gitignore +7 -0
- compliance_aiops-0.1.0/CHANGELOG.md +57 -0
- compliance_aiops-0.1.0/LICENSE +21 -0
- compliance_aiops-0.1.0/PKG-INFO +151 -0
- compliance_aiops-0.1.0/README.md +135 -0
- compliance_aiops-0.1.0/RELEASE_NOTES.md +54 -0
- compliance_aiops-0.1.0/SECURITY.md +86 -0
- compliance_aiops-0.1.0/compliance_aiops/__init__.py +9 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/__init__.py +9 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/_common.py +77 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/_root.py +57 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/bundle.py +67 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/doctor.py +21 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/init.py +87 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/overview.py +16 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/report.py +70 -0
- compliance_aiops-0.1.0/compliance_aiops/cli/secret.py +105 -0
- compliance_aiops-0.1.0/compliance_aiops/config.py +124 -0
- compliance_aiops-0.1.0/compliance_aiops/connection.py +163 -0
- compliance_aiops-0.1.0/compliance_aiops/doctor.py +69 -0
- compliance_aiops-0.1.0/compliance_aiops/frameworks.py +164 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/__init__.py +40 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/audit.py +377 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/budget.py +225 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/decorators.py +474 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/paths.py +23 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/patterns.py +378 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/policy.py +411 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/sanitize.py +39 -0
- compliance_aiops-0.1.0/compliance_aiops/governance/undo.py +218 -0
- compliance_aiops-0.1.0/compliance_aiops/hashchain.py +71 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/__init__.py +1 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/_util.py +63 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/bundle.py +216 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/controls.py +138 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/events.py +51 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/integrity.py +82 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/overview.py +40 -0
- compliance_aiops-0.1.0/compliance_aiops/ops/reports.py +55 -0
- compliance_aiops-0.1.0/compliance_aiops/secretstore.py +302 -0
- compliance_aiops-0.1.0/mcp_server/__init__.py +1 -0
- compliance_aiops-0.1.0/mcp_server/_shared.py +113 -0
- compliance_aiops-0.1.0/mcp_server/server.py +35 -0
- compliance_aiops-0.1.0/mcp_server/tools/__init__.py +1 -0
- compliance_aiops-0.1.0/mcp_server/tools/bundle.py +72 -0
- compliance_aiops-0.1.0/mcp_server/tools/controls.py +66 -0
- compliance_aiops-0.1.0/mcp_server/tools/events.py +59 -0
- compliance_aiops-0.1.0/mcp_server/tools/integrity.py +37 -0
- compliance_aiops-0.1.0/mcp_server/tools/reports.py +38 -0
- compliance_aiops-0.1.0/pyproject.toml +59 -0
- compliance_aiops-0.1.0/server.json +21 -0
- compliance_aiops-0.1.0/skills/compliance-aiops/SKILL.md +141 -0
- compliance_aiops-0.1.0/skills/compliance-aiops/references/capabilities.md +68 -0
- compliance_aiops-0.1.0/skills/compliance-aiops/references/cli-reference.md +58 -0
- compliance_aiops-0.1.0/skills/compliance-aiops/references/setup-guide.md +95 -0
- compliance_aiops-0.1.0/smithery.yaml +9 -0
- compliance_aiops-0.1.0/tests/test_secretstore.py +99 -0
- compliance_aiops-0.1.0/tests/test_smoke.py +295 -0
- compliance_aiops-0.1.0/uv.lock +962 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Trusted Publishing (OIDC) — publishes from GitHub's runners with no API token,
|
|
4
|
+
# sidestepping the local-IP / account new-project rate limit. Configure a matching
|
|
5
|
+
# "trusted publisher" for this package on PyPI (see the repo release notes).
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [published]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
publish:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
id-token: write # required for PyPI Trusted Publishing (OIDC)
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- name: Set up uv
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
- name: Build sdist + wheel
|
|
24
|
+
run: uv build
|
|
25
|
+
- name: Publish to PyPI (Trusted Publishing)
|
|
26
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to compliance-aiops are documented here. This project adheres
|
|
4
|
+
to [Semantic Versioning](https://semver.org/) and the
|
|
5
|
+
[Keep a Changelog](https://keepachangelog.com/) format.
|
|
6
|
+
|
|
7
|
+
## [0.1.0] — preview
|
|
8
|
+
|
|
9
|
+
Initial preview release: governed **compliance-evidence** tooling that reads the
|
|
10
|
+
local audit trails governed AIops agents already write (`~/.<tool>-aiops/audit.db`,
|
|
11
|
+
discovered via `~/.*-aiops/audit.db`) **read-only** and turns them into
|
|
12
|
+
**framework-mapped, hash-chain-sealed** evidence. **No external API, no network,
|
|
13
|
+
no platform credentials.** Evidence, not certification. Standalone governance
|
|
14
|
+
harness bundled in the package.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **15 MCP tools** (12 read/analysis, 3 write/artifact — no external mutation):
|
|
19
|
+
- **Audit reads** — `list_audit_sources`, `query_audit_events` (filter by
|
|
20
|
+
tool/skill/status/risk/approved/selector/since/until), `activity_timeline`
|
|
21
|
+
(hour/day buckets).
|
|
22
|
+
- **Framework mapping** — `list_frameworks`, `coverage_summary` (per-control,
|
|
23
|
+
one framework), `control_evidence` (evidence rows + population + reproducible
|
|
24
|
+
query for one control), `gap_analysis` (no/weak-evidence controls + honest
|
|
25
|
+
caveat + remediation).
|
|
26
|
+
- **Assurance reports** — `approval_report` (high-risk write ops + approver +
|
|
27
|
+
rationale), `exceptions_report` (denied / error / budget_exceeded).
|
|
28
|
+
- **Integrity** — `verify_source_chain` (chain head + row-id gap detection),
|
|
29
|
+
`verify_bundle` (chain + seal head + signature), `list_bundles`.
|
|
30
|
+
- **Artifacts** — `generate_evidence_bundle` (low; coverage + approval trail +
|
|
31
|
+
exceptions + sealed records → a bundle `.json`), `export_bundle` (low;
|
|
32
|
+
markdown / csv / json), `sign_bundle` (medium; HMAC over the seal).
|
|
33
|
+
- **Framework catalog** (`compliance_aiops/frameworks.py`) — HIPAA §164.312,
|
|
34
|
+
PCI-DSS v4.0, SOC 2 TSC, GDPR, each control carrying an evidence-strength label
|
|
35
|
+
(`strong` / `partial`) and an honest caveat.
|
|
36
|
+
- **Hash-chain integrity** (`compliance_aiops/hashchain.py`) — SHA-256 over
|
|
37
|
+
ordered records (`hash = SHA-256(prev_hash ‖ canonical_json(record))`, genesis
|
|
38
|
+
prev = 64 zeros), reproducible `chainHead`, optional HMAC signature.
|
|
39
|
+
- **Ops modules** (`compliance_aiops/ops/`) — `events`, `controls`, `reports`,
|
|
40
|
+
`overview`, `bundle`, `integrity`.
|
|
41
|
+
- **Encrypted signing-key store** — the bundle-signing key is stored encrypted in
|
|
42
|
+
`~/.compliance-aiops/secrets.enc` (Fernet + scrypt); unlocked via
|
|
43
|
+
`COMPLIANCE_AIOPS_MASTER_PASSWORD`. No platform credentials are used.
|
|
44
|
+
- **CLI** (`compliance-aiops`) — `init`, `overview`, `report`
|
|
45
|
+
(sources/coverage/gaps/approvals/exceptions), `bundle`
|
|
46
|
+
(generate/verify/list/export), `secret` (set/list/rm/migrate/rotate-password),
|
|
47
|
+
`doctor`, `mcp`.
|
|
48
|
+
- **Deterministic offline tests** — synthetic audit DBs built via the real
|
|
49
|
+
harness `AuditEngine`, a golden reproducible `chainHead`, and tamper tests.
|
|
50
|
+
|
|
51
|
+
### Known limitations
|
|
52
|
+
|
|
53
|
+
- **Tamper-EVIDENT, not tamper-PROOF** — the source `audit.db` remains the system
|
|
54
|
+
of record.
|
|
55
|
+
- **Evidence, not certification.** OSCAL export is a v0.2 roadmap item (v0.1 emits
|
|
56
|
+
JSON + Markdown + CSV shaped to ease a future OSCAL Assessment-Results adapter).
|
|
57
|
+
- **Preview** — interfaces may change before v1.0.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wei <zhouwei008@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: compliance-aiops
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Governed compliance-evidence tooling: reads the AIops governance audit trails and produces framework-mapped (HIPAA/PCI-DSS/SOC2/GDPR), hash-chain-sealed evidence bundles with a built-in governance harness (audit, budget, risk tiers)
|
|
5
|
+
Author-email: wei <zhouwei008@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: cryptography>=42.0
|
|
10
|
+
Requires-Dist: httpx<1.0,>=0.27
|
|
11
|
+
Requires-Dist: mcp[cli]<2.0,>=1.10
|
|
12
|
+
Requires-Dist: pyyaml<7.0,>=6.0
|
|
13
|
+
Requires-Dist: rich<16.0,>=13.0
|
|
14
|
+
Requires-Dist: typer<1.0,>=0.12
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
<!-- mcp-name: io.github.AIops-tools/compliance-aiops -->
|
|
18
|
+
|
|
19
|
+
# Compliance AIops (preview)
|
|
20
|
+
|
|
21
|
+
> **Disclaimer**: Community-maintained open-source project. **Not affiliated with, endorsed by, or sponsored by any framework body or GRC vendor.** HIPAA, PCI-DSS, SOC 2, GDPR and OSCAL are referenced descriptively; the frameworks and trademarks belong to their owners. MIT licensed.
|
|
22
|
+
|
|
23
|
+
Governed **compliance-evidence** tooling for AI-agent infrastructure ops. It
|
|
24
|
+
**reads the audit trails your governed AIops agents already write** — the local
|
|
25
|
+
`~/.<tool>-aiops/audit.db` SQLite trails, all sharing one `audit_log` schema —
|
|
26
|
+
and turns that activity into **framework-mapped, hash-chain-sealed compliance
|
|
27
|
+
evidence**. It **never scans your infrastructure and never replaces a GRC
|
|
28
|
+
platform**: it converts the trails you already produce into auditor-ready,
|
|
29
|
+
tamper-evident evidence bundles.
|
|
30
|
+
|
|
31
|
+
Unlike the other tools in the AIops-tools line it is **not a platform wrapper**:
|
|
32
|
+
**no external API, no network, no platform credentials**. Its only inputs are
|
|
33
|
+
those on-disk audit databases, read **read-only**. That also makes it the
|
|
34
|
+
easiest-to-self-test tool in the line — fully offline and deterministic.
|
|
35
|
+
|
|
36
|
+
> **Preview.** Evidence, not certification. Fully offline; the source `audit.db`
|
|
37
|
+
> files remain the system of record. OSCAL export is a documented v0.2 roadmap
|
|
38
|
+
> item (v0.1 emits JSON + Markdown + CSV shaped to ease a future OSCAL
|
|
39
|
+
> Assessment-Results adapter).
|
|
40
|
+
|
|
41
|
+
## Key features
|
|
42
|
+
|
|
43
|
+
- **Framework mapping with honest evidence-strength** — audit events map to
|
|
44
|
+
**HIPAA §164.312 / PCI-DSS v4.0 / SOC 2 TSC / GDPR** controls. Audit trails
|
|
45
|
+
prove *operating effectiveness* strongly but *control design / configuration*
|
|
46
|
+
only partially, and each control is labelled `strong` or `partial`.
|
|
47
|
+
`gap_analysis` says so per control, with the caveat and a remediation hint.
|
|
48
|
+
- **Hash-chain-sealed evidence bundles** — SHA-256 over ordered records
|
|
49
|
+
(`hash = SHA-256(prev_hash ‖ canonical_json(record))`, genesis prev = 64
|
|
50
|
+
zeros). The `chainHead` is **reproducible** for the same (framework, period,
|
|
51
|
+
sources). `verify_bundle` catches tampering; `verify_source_chain` detects
|
|
52
|
+
row-id gaps / deletions in a source trail. An optional HMAC signature seals a
|
|
53
|
+
bundle under a stored signing key.
|
|
54
|
+
- **Zero-network, read-only** — no credentials, no outbound calls, no mutation
|
|
55
|
+
of the source trails. Bundles are the only thing written, under
|
|
56
|
+
`~/.compliance-aiops/bundles/`.
|
|
57
|
+
- **Deterministic, test-verified integrity** — the integrity claims are
|
|
58
|
+
themselves covered by tests: synthetic audit DBs are built through the real
|
|
59
|
+
governance-harness `AuditEngine`, a golden reproducible `chainHead` is
|
|
60
|
+
asserted, and tamper tests confirm detection. No live infrastructure needed.
|
|
61
|
+
|
|
62
|
+
## Tools (15 MCP tools)
|
|
63
|
+
|
|
64
|
+
### Read / analysis (12)
|
|
65
|
+
|
|
66
|
+
| Tool | Purpose |
|
|
67
|
+
|------|---------|
|
|
68
|
+
| `list_audit_sources` | Discovered sibling audit DBs (path, tool, readable, row count) |
|
|
69
|
+
| `query_audit_events` | Cross-tool event query — filter by tool/skill/status/risk/approved/selector/since/until |
|
|
70
|
+
| `activity_timeline` | Event counts bucketed by hour or day |
|
|
71
|
+
| `list_frameworks` | Supported frameworks + control counts |
|
|
72
|
+
| `coverage_summary` | Per-control covered/weak/uncovered for ONE framework |
|
|
73
|
+
| `control_evidence` | Evidence rows + population + a reproducible query for ONE control |
|
|
74
|
+
| `gap_analysis` | Controls with no/weak evidence + honest caveat + remediation |
|
|
75
|
+
| `approval_report` | High-risk write ops + who approved + rationale (the CC8.1 / PCI 7-8 / HIPAA §312(a) artifact) |
|
|
76
|
+
| `exceptions_report` | Denied / error / budget_exceeded ops — enforcement + anomaly evidence |
|
|
77
|
+
| `verify_source_chain` | Chain head + row-id gap detection for one source |
|
|
78
|
+
| `verify_bundle` | Verify a sealed bundle: chain + seal head + optional signature |
|
|
79
|
+
| `list_bundles` | Bundles under `~/.compliance-aiops/bundles/` |
|
|
80
|
+
|
|
81
|
+
### Write / artifact (3 — no external mutation)
|
|
82
|
+
|
|
83
|
+
| Tool | Risk | Purpose |
|
|
84
|
+
|------|:---:|---------|
|
|
85
|
+
| `generate_evidence_bundle` | low | One call: coverage + approval trail + exceptions + sealed records → a bundle `.json` |
|
|
86
|
+
| `export_bundle` | low | Render a bundle to markdown / csv / json |
|
|
87
|
+
| `sign_bundle` | medium | HMAC over the seal using the stored signing key |
|
|
88
|
+
|
|
89
|
+
The CLI exposes a convenience subset; the full 15-tool surface is available over MCP.
|
|
90
|
+
|
|
91
|
+
## Frameworks & controls
|
|
92
|
+
|
|
93
|
+
| Framework | Sample controls (strength) |
|
|
94
|
+
|-----------|----------------------------|
|
|
95
|
+
| **HIPAA** (§164.312) | 164.312(b) Audit controls (strong), 164.312(a)(1) Access control (strong), 164.312(c)(1) Integrity (strong) |
|
|
96
|
+
| **PCI-DSS v4.0** | 10.2 Audit log content (strong), 10.3 Protect audit logs (strong), 7-8 Least privilege / authn (partial) |
|
|
97
|
+
| **SOC 2 TSC** | CC6.1 Logical access (strong), CC7.2 Monitoring (strong), CC8.1 Change management (strong) |
|
|
98
|
+
| **GDPR** | Art.30 Records of processing (partial), Art.32 Security of processing (strong) |
|
|
99
|
+
|
|
100
|
+
## Install
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
uv tool install compliance-aiops # or: pipx install compliance-aiops
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Quick start
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
compliance-aiops init # discover sibling ~/.*-aiops/audit.db, set org name, optional signing key
|
|
110
|
+
compliance-aiops doctor # which sibling audit DBs are present/readable
|
|
111
|
+
compliance-aiops overview # audit sources + per-framework covered/total
|
|
112
|
+
compliance-aiops report coverage soc2 # per-control SOC 2 coverage
|
|
113
|
+
compliance-aiops bundle generate soc2 # sealed evidence bundle → ~/.compliance-aiops/bundles/
|
|
114
|
+
compliance-aiops bundle verify <path> # re-verify the chain + seal (+ signature)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Run as an MCP server (stdio):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
export COMPLIANCE_AIOPS_MASTER_PASSWORD=... # only needed to unlock a signing key
|
|
121
|
+
compliance-aiops mcp # or: compliance-aiops-mcp
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Integrity & honest limits
|
|
125
|
+
|
|
126
|
+
- **Tamper-EVIDENT, not tamper-PROOF.** The hash chain and optional signature
|
|
127
|
+
let an auditor *detect* alteration; they do not prevent it. The source
|
|
128
|
+
`audit.db` files remain the system of record — record the `chainHead`
|
|
129
|
+
out-of-band if you need an independent anchor.
|
|
130
|
+
- **Operating effectiveness vs. design.** An audit trail strongly evidences that
|
|
131
|
+
a control *ran* (samples, approvals, denials) but only partially evidences that
|
|
132
|
+
a control is *designed / configured* correctly (e.g. MFA required,
|
|
133
|
+
least-privilege roles). Every control carries a `strong` / `partial` label and
|
|
134
|
+
`gap_analysis` surfaces the caveat rather than overclaiming.
|
|
135
|
+
|
|
136
|
+
## Supported scope & limitations (preview)
|
|
137
|
+
|
|
138
|
+
- **Evidence, not certification.** This produces auditor-ready evidence bundles;
|
|
139
|
+
it does not issue attestations, opinions, or certifications.
|
|
140
|
+
- **In scope:** the four frameworks above, over the `audit_log` trails written by
|
|
141
|
+
governed AIops tools discovered via `~/.*-aiops/audit.db`.
|
|
142
|
+
- **Not in scope:** it does **not** scan infrastructure, connect to any platform,
|
|
143
|
+
or replace a GRC platform. For platform operations use the other AIops-tools.
|
|
144
|
+
- **OSCAL export is v0.2.** v0.1 emits JSON + Markdown + CSV.
|
|
145
|
+
- **Preview:** interfaces may change before v1.0.
|
|
146
|
+
|
|
147
|
+
## Missing a capability?
|
|
148
|
+
|
|
149
|
+
Want another framework, control mapping, export format (OSCAL, CSV shape), or a
|
|
150
|
+
verification you don't see here? **Open an issue or a PR — contributions
|
|
151
|
+
welcome.**
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.AIops-tools/compliance-aiops -->
|
|
2
|
+
|
|
3
|
+
# Compliance AIops (preview)
|
|
4
|
+
|
|
5
|
+
> **Disclaimer**: Community-maintained open-source project. **Not affiliated with, endorsed by, or sponsored by any framework body or GRC vendor.** HIPAA, PCI-DSS, SOC 2, GDPR and OSCAL are referenced descriptively; the frameworks and trademarks belong to their owners. MIT licensed.
|
|
6
|
+
|
|
7
|
+
Governed **compliance-evidence** tooling for AI-agent infrastructure ops. It
|
|
8
|
+
**reads the audit trails your governed AIops agents already write** — the local
|
|
9
|
+
`~/.<tool>-aiops/audit.db` SQLite trails, all sharing one `audit_log` schema —
|
|
10
|
+
and turns that activity into **framework-mapped, hash-chain-sealed compliance
|
|
11
|
+
evidence**. It **never scans your infrastructure and never replaces a GRC
|
|
12
|
+
platform**: it converts the trails you already produce into auditor-ready,
|
|
13
|
+
tamper-evident evidence bundles.
|
|
14
|
+
|
|
15
|
+
Unlike the other tools in the AIops-tools line it is **not a platform wrapper**:
|
|
16
|
+
**no external API, no network, no platform credentials**. Its only inputs are
|
|
17
|
+
those on-disk audit databases, read **read-only**. That also makes it the
|
|
18
|
+
easiest-to-self-test tool in the line — fully offline and deterministic.
|
|
19
|
+
|
|
20
|
+
> **Preview.** Evidence, not certification. Fully offline; the source `audit.db`
|
|
21
|
+
> files remain the system of record. OSCAL export is a documented v0.2 roadmap
|
|
22
|
+
> item (v0.1 emits JSON + Markdown + CSV shaped to ease a future OSCAL
|
|
23
|
+
> Assessment-Results adapter).
|
|
24
|
+
|
|
25
|
+
## Key features
|
|
26
|
+
|
|
27
|
+
- **Framework mapping with honest evidence-strength** — audit events map to
|
|
28
|
+
**HIPAA §164.312 / PCI-DSS v4.0 / SOC 2 TSC / GDPR** controls. Audit trails
|
|
29
|
+
prove *operating effectiveness* strongly but *control design / configuration*
|
|
30
|
+
only partially, and each control is labelled `strong` or `partial`.
|
|
31
|
+
`gap_analysis` says so per control, with the caveat and a remediation hint.
|
|
32
|
+
- **Hash-chain-sealed evidence bundles** — SHA-256 over ordered records
|
|
33
|
+
(`hash = SHA-256(prev_hash ‖ canonical_json(record))`, genesis prev = 64
|
|
34
|
+
zeros). The `chainHead` is **reproducible** for the same (framework, period,
|
|
35
|
+
sources). `verify_bundle` catches tampering; `verify_source_chain` detects
|
|
36
|
+
row-id gaps / deletions in a source trail. An optional HMAC signature seals a
|
|
37
|
+
bundle under a stored signing key.
|
|
38
|
+
- **Zero-network, read-only** — no credentials, no outbound calls, no mutation
|
|
39
|
+
of the source trails. Bundles are the only thing written, under
|
|
40
|
+
`~/.compliance-aiops/bundles/`.
|
|
41
|
+
- **Deterministic, test-verified integrity** — the integrity claims are
|
|
42
|
+
themselves covered by tests: synthetic audit DBs are built through the real
|
|
43
|
+
governance-harness `AuditEngine`, a golden reproducible `chainHead` is
|
|
44
|
+
asserted, and tamper tests confirm detection. No live infrastructure needed.
|
|
45
|
+
|
|
46
|
+
## Tools (15 MCP tools)
|
|
47
|
+
|
|
48
|
+
### Read / analysis (12)
|
|
49
|
+
|
|
50
|
+
| Tool | Purpose |
|
|
51
|
+
|------|---------|
|
|
52
|
+
| `list_audit_sources` | Discovered sibling audit DBs (path, tool, readable, row count) |
|
|
53
|
+
| `query_audit_events` | Cross-tool event query — filter by tool/skill/status/risk/approved/selector/since/until |
|
|
54
|
+
| `activity_timeline` | Event counts bucketed by hour or day |
|
|
55
|
+
| `list_frameworks` | Supported frameworks + control counts |
|
|
56
|
+
| `coverage_summary` | Per-control covered/weak/uncovered for ONE framework |
|
|
57
|
+
| `control_evidence` | Evidence rows + population + a reproducible query for ONE control |
|
|
58
|
+
| `gap_analysis` | Controls with no/weak evidence + honest caveat + remediation |
|
|
59
|
+
| `approval_report` | High-risk write ops + who approved + rationale (the CC8.1 / PCI 7-8 / HIPAA §312(a) artifact) |
|
|
60
|
+
| `exceptions_report` | Denied / error / budget_exceeded ops — enforcement + anomaly evidence |
|
|
61
|
+
| `verify_source_chain` | Chain head + row-id gap detection for one source |
|
|
62
|
+
| `verify_bundle` | Verify a sealed bundle: chain + seal head + optional signature |
|
|
63
|
+
| `list_bundles` | Bundles under `~/.compliance-aiops/bundles/` |
|
|
64
|
+
|
|
65
|
+
### Write / artifact (3 — no external mutation)
|
|
66
|
+
|
|
67
|
+
| Tool | Risk | Purpose |
|
|
68
|
+
|------|:---:|---------|
|
|
69
|
+
| `generate_evidence_bundle` | low | One call: coverage + approval trail + exceptions + sealed records → a bundle `.json` |
|
|
70
|
+
| `export_bundle` | low | Render a bundle to markdown / csv / json |
|
|
71
|
+
| `sign_bundle` | medium | HMAC over the seal using the stored signing key |
|
|
72
|
+
|
|
73
|
+
The CLI exposes a convenience subset; the full 15-tool surface is available over MCP.
|
|
74
|
+
|
|
75
|
+
## Frameworks & controls
|
|
76
|
+
|
|
77
|
+
| Framework | Sample controls (strength) |
|
|
78
|
+
|-----------|----------------------------|
|
|
79
|
+
| **HIPAA** (§164.312) | 164.312(b) Audit controls (strong), 164.312(a)(1) Access control (strong), 164.312(c)(1) Integrity (strong) |
|
|
80
|
+
| **PCI-DSS v4.0** | 10.2 Audit log content (strong), 10.3 Protect audit logs (strong), 7-8 Least privilege / authn (partial) |
|
|
81
|
+
| **SOC 2 TSC** | CC6.1 Logical access (strong), CC7.2 Monitoring (strong), CC8.1 Change management (strong) |
|
|
82
|
+
| **GDPR** | Art.30 Records of processing (partial), Art.32 Security of processing (strong) |
|
|
83
|
+
|
|
84
|
+
## Install
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
uv tool install compliance-aiops # or: pipx install compliance-aiops
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Quick start
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
compliance-aiops init # discover sibling ~/.*-aiops/audit.db, set org name, optional signing key
|
|
94
|
+
compliance-aiops doctor # which sibling audit DBs are present/readable
|
|
95
|
+
compliance-aiops overview # audit sources + per-framework covered/total
|
|
96
|
+
compliance-aiops report coverage soc2 # per-control SOC 2 coverage
|
|
97
|
+
compliance-aiops bundle generate soc2 # sealed evidence bundle → ~/.compliance-aiops/bundles/
|
|
98
|
+
compliance-aiops bundle verify <path> # re-verify the chain + seal (+ signature)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Run as an MCP server (stdio):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export COMPLIANCE_AIOPS_MASTER_PASSWORD=... # only needed to unlock a signing key
|
|
105
|
+
compliance-aiops mcp # or: compliance-aiops-mcp
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Integrity & honest limits
|
|
109
|
+
|
|
110
|
+
- **Tamper-EVIDENT, not tamper-PROOF.** The hash chain and optional signature
|
|
111
|
+
let an auditor *detect* alteration; they do not prevent it. The source
|
|
112
|
+
`audit.db` files remain the system of record — record the `chainHead`
|
|
113
|
+
out-of-band if you need an independent anchor.
|
|
114
|
+
- **Operating effectiveness vs. design.** An audit trail strongly evidences that
|
|
115
|
+
a control *ran* (samples, approvals, denials) but only partially evidences that
|
|
116
|
+
a control is *designed / configured* correctly (e.g. MFA required,
|
|
117
|
+
least-privilege roles). Every control carries a `strong` / `partial` label and
|
|
118
|
+
`gap_analysis` surfaces the caveat rather than overclaiming.
|
|
119
|
+
|
|
120
|
+
## Supported scope & limitations (preview)
|
|
121
|
+
|
|
122
|
+
- **Evidence, not certification.** This produces auditor-ready evidence bundles;
|
|
123
|
+
it does not issue attestations, opinions, or certifications.
|
|
124
|
+
- **In scope:** the four frameworks above, over the `audit_log` trails written by
|
|
125
|
+
governed AIops tools discovered via `~/.*-aiops/audit.db`.
|
|
126
|
+
- **Not in scope:** it does **not** scan infrastructure, connect to any platform,
|
|
127
|
+
or replace a GRC platform. For platform operations use the other AIops-tools.
|
|
128
|
+
- **OSCAL export is v0.2.** v0.1 emits JSON + Markdown + CSV.
|
|
129
|
+
- **Preview:** interfaces may change before v1.0.
|
|
130
|
+
|
|
131
|
+
## Missing a capability?
|
|
132
|
+
|
|
133
|
+
Want another framework, control mapping, export format (OSCAL, CSV shape), or a
|
|
134
|
+
verification you don't see here? **Open an issue or a PR — contributions
|
|
135
|
+
welcome.**
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Compliance AIops v0.1.0 — preview
|
|
2
|
+
|
|
3
|
+
Governed **compliance-evidence** tooling for AI-agent infrastructure ops. It
|
|
4
|
+
**reads the local audit trails your governed AIops agents already write**
|
|
5
|
+
(`~/.<tool>-aiops/audit.db`, one shared `audit_log` schema, discovered via
|
|
6
|
+
`~/.*-aiops/audit.db`) **read-only**, and turns that activity into
|
|
7
|
+
**framework-mapped, hash-chain-sealed compliance evidence**. It does **not** scan
|
|
8
|
+
infrastructure and does **not** replace a GRC platform.
|
|
9
|
+
|
|
10
|
+
Unlike the other tools in the AIops-tools line it is **not a platform wrapper** —
|
|
11
|
+
**no external API, no network, no platform credentials**. Standalone: the
|
|
12
|
+
governance harness is bundled in the package.
|
|
13
|
+
|
|
14
|
+
> **Preview.** Evidence, not certification. Fully offline; the source `audit.db`
|
|
15
|
+
> files remain the system of record. The integrity claims are themselves
|
|
16
|
+
> test-verified (see below).
|
|
17
|
+
|
|
18
|
+
## Highlights
|
|
19
|
+
|
|
20
|
+
- **15 MCP tools** — 12 read/analysis, 3 write/artifact (no external mutation).
|
|
21
|
+
- Read: `list_audit_sources`, `query_audit_events`, `activity_timeline`,
|
|
22
|
+
`list_frameworks`, `coverage_summary`, `control_evidence`, `gap_analysis`,
|
|
23
|
+
`approval_report`, `exceptions_report`, `verify_source_chain`,
|
|
24
|
+
`verify_bundle`, `list_bundles`.
|
|
25
|
+
- Write: `generate_evidence_bundle` (low), `export_bundle` (low),
|
|
26
|
+
`sign_bundle` (medium).
|
|
27
|
+
- **Framework mapping with honest evidence-strength** — HIPAA §164.312 /
|
|
28
|
+
PCI-DSS v4.0 / SOC 2 TSC / GDPR. Audit trails prove *operating effectiveness*
|
|
29
|
+
strongly and *design / configuration* only partially; each control is labelled
|
|
30
|
+
`strong` / `partial` and `gap_analysis` surfaces the caveat.
|
|
31
|
+
- **Hash-chain-sealed bundles** — SHA-256 over ordered records, reproducible
|
|
32
|
+
`chainHead`, optional HMAC signature. `verify_bundle` catches tampering;
|
|
33
|
+
`verify_source_chain` detects row-id gaps / deletions.
|
|
34
|
+
- **Zero-network, read-only** — no credentials, no outbound calls, no mutation of
|
|
35
|
+
the source trails. Bundles written to `~/.compliance-aiops/bundles/`.
|
|
36
|
+
- **Deterministic offline tests** — synthetic audit DBs built through the real
|
|
37
|
+
harness `AuditEngine`, a golden reproducible `chainHead`, and tamper tests.
|
|
38
|
+
No live infrastructure dependency.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv tool install compliance-aiops
|
|
44
|
+
compliance-aiops init # discover sibling audit DBs, set org name, optional signing key
|
|
45
|
+
compliance-aiops doctor # which sibling audit DBs are present/readable
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Caveats
|
|
49
|
+
|
|
50
|
+
- **Tamper-EVIDENT, not tamper-PROOF** — the source `audit.db` remains the system
|
|
51
|
+
of record; record the `chainHead` out-of-band for an independent anchor.
|
|
52
|
+
- **Evidence, not certification.** OSCAL export is a documented v0.2 roadmap item
|
|
53
|
+
(v0.1 emits JSON + Markdown + CSV).
|
|
54
|
+
- **Preview:** interfaces may change before v1.0.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Disclaimer
|
|
4
|
+
|
|
5
|
+
Community-maintained open-source project. Not a substitute for a GRC program or
|
|
6
|
+
legal advice — it produces **evidence from audit trails**, it does not certify
|
|
7
|
+
compliance. Framework names (HIPAA, PCI-DSS, SOC 2, GDPR) belong to their
|
|
8
|
+
respective bodies. Source is publicly auditable under the MIT license.
|
|
9
|
+
|
|
10
|
+
## Reporting Vulnerabilities
|
|
11
|
+
|
|
12
|
+
Report privately via a GitHub Security Advisory on
|
|
13
|
+
[github.com/AIops-tools/Compliance-AIops](https://github.com/AIops-tools/Compliance-AIops/security/advisories)
|
|
14
|
+
or email zhouwei008@gmail.com. Please do not open public issues for security
|
|
15
|
+
reports.
|
|
16
|
+
|
|
17
|
+
## Security Design
|
|
18
|
+
|
|
19
|
+
### Data Sources — read-only, no credentials
|
|
20
|
+
- compliance-aiops has **no external API and no platform credentials**. Its data
|
|
21
|
+
sources are the sibling AIops tools' audit databases (`~/.<tool>-aiops/audit.db`),
|
|
22
|
+
opened strictly **read-only** (SQLite `mode=ro`). It never writes to a source DB
|
|
23
|
+
— evidence is derived, the originals are untouched.
|
|
24
|
+
- The **only** secret it can hold is an **optional bundle-signing key**, stored
|
|
25
|
+
**encrypted** in `~/.compliance-aiops/secrets.enc` (Fernet/AES-128 +
|
|
26
|
+
scrypt-derived key; chmod 600). Evidence bundles are always hash-chain-sealed;
|
|
27
|
+
the signing key only adds a signature. With no key configured the tool works
|
|
28
|
+
fully (chain-only integrity).
|
|
29
|
+
|
|
30
|
+
### Tamper-evident integrity (and its honest limits)
|
|
31
|
+
- Evidence bundles are sealed with a **SHA-256 hash chain** over the ordered
|
|
32
|
+
evidence records (`hash_i = SHA-256(prev_hash || canonical_json(record))`); the
|
|
33
|
+
`chainHead` commits to the whole set. `verify_bundle` / `verify_source_chain`
|
|
34
|
+
recompute the chain and localise the first broken link, plus detect **row-id
|
|
35
|
+
gaps** (possible deletions). An optional HMAC signature over the seal adds
|
|
36
|
+
provenance.
|
|
37
|
+
- **A hash chain is tamper-*evident*, not tamper-*proof*.** It detects casual /
|
|
38
|
+
single-row edits against a previously recorded `chainHead` and proves a held
|
|
39
|
+
bundle is unaltered since sealing; it cannot stop an attacker with write access
|
|
40
|
+
to the source DB *and* the ability to re-seal. The source `audit.db` remains the
|
|
41
|
+
source of truth — record the `chainHead` out-of-band.
|
|
42
|
+
|
|
43
|
+
### Governed Operations
|
|
44
|
+
Every MCP tool runs through the bundled `@governed_tool` harness
|
|
45
|
+
(`compliance_aiops.governance`):
|
|
46
|
+
- **Audit** — every call logged to a local SQLite DB under `~/.compliance-aiops/`
|
|
47
|
+
(relocatable via `COMPLIANCE_AIOPS_HOME`), agent-attributed, secret-redacted.
|
|
48
|
+
- **Token/runaway budget** — hard ceilings (`COMPLIANCE_MAX_TOOL_CALLS` /
|
|
49
|
+
`COMPLIANCE_MAX_TOOL_SECONDS`) plus an on-by-default guard that trips a tight
|
|
50
|
+
poll/retry loop, preventing unbounded API consumption (e.g. polling a slow
|
|
51
|
+
session).
|
|
52
|
+
- **Graduated risk tiers** — `~/.compliance-aiops/rules.yaml` `risk_tiers` gate
|
|
53
|
+
writes by environment/tag; the highest tiers require a recorded approver.
|
|
54
|
+
- **Recursive self-audit** — compliance-aiops runs through the harness like every
|
|
55
|
+
other tool, so its own evidence-generation activity is itself audited (and is
|
|
56
|
+
evidence-eligible).
|
|
57
|
+
|
|
58
|
+
### State-Changing Operations
|
|
59
|
+
There are **none against external systems**. The only "writes" are local
|
|
60
|
+
artifacts: `generate_evidence_bundle` / `export_bundle` write a bundle file under
|
|
61
|
+
`~/.compliance-aiops/bundles/` (risk=low), and `sign_bundle` reads the encrypted
|
|
62
|
+
signing key (risk=medium). No dry-run/double-confirm is needed because nothing
|
|
63
|
+
external is mutated.
|
|
64
|
+
|
|
65
|
+
### Prompt-Injection Protection
|
|
66
|
+
The audit trail is data produced by other tools, so it is treated as untrusted:
|
|
67
|
+
all audit-sourced text (tool names, rationale, approver, event fields) passes
|
|
68
|
+
through a `sanitize()` truncate + control-character strip before reaching the
|
|
69
|
+
agent or a bundle.
|
|
70
|
+
|
|
71
|
+
### Network Scope
|
|
72
|
+
**Zero network.** No webhooks, no telemetry, no outbound calls of any kind — the
|
|
73
|
+
tool only reads local SQLite files and writes local artifacts. No post-install
|
|
74
|
+
scripts or background services.
|
|
75
|
+
|
|
76
|
+
## Static Analysis
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uvx bandit -r compliance_aiops/ mcp_server/
|
|
80
|
+
uv run ruff check .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Supported Versions
|
|
84
|
+
|
|
85
|
+
The latest released version receives security fixes. This is a preview (0.x);
|
|
86
|
+
pin a version in production.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""compliance-aiops — governed Compliance SCALE operations for AI agents.
|
|
2
|
+
|
|
3
|
+
Standalone and self-contained: the governance harness (audit, token budget,
|
|
4
|
+
undo-token recording, graduated risk tiers, prompt-injection sanitize) is
|
|
5
|
+
bundled under ``compliance_aiops.governance`` — this package has no external
|
|
6
|
+
skill-family dependency. Preview: not yet full-coverage.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Shared helpers for compliance-aiops CLI sub-modules."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import functools
|
|
6
|
+
from collections.abc import Callable
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Annotated, Any
|
|
9
|
+
|
|
10
|
+
import typer
|
|
11
|
+
from rich.console import Console
|
|
12
|
+
|
|
13
|
+
console = Console()
|
|
14
|
+
|
|
15
|
+
# ─── Shared Option types ───────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
TargetOption = Annotated[
|
|
18
|
+
str | None, typer.Option("--target", "-t", help="Target name from config")
|
|
19
|
+
]
|
|
20
|
+
DryRunOption = Annotated[
|
|
21
|
+
bool, typer.Option("--dry-run", help="Print the API call without executing")
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _cli_error_types() -> tuple[type[BaseException], ...]:
|
|
26
|
+
"""Exceptions translated to a one-line teaching error instead of a traceback."""
|
|
27
|
+
from compliance_aiops.connection import ComplianceError
|
|
28
|
+
|
|
29
|
+
return (ComplianceError, KeyError, OSError, ValueError)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def cli_errors(fn: Callable) -> Callable:
|
|
33
|
+
"""Translate known exceptions into one red line + exit code 1."""
|
|
34
|
+
|
|
35
|
+
@functools.wraps(fn)
|
|
36
|
+
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
37
|
+
try:
|
|
38
|
+
return fn(*args, **kwargs)
|
|
39
|
+
except (typer.Exit, typer.Abort):
|
|
40
|
+
raise
|
|
41
|
+
except _cli_error_types() as e:
|
|
42
|
+
message = str(e)
|
|
43
|
+
if isinstance(e, KeyError):
|
|
44
|
+
message = f"Missing required key or environment variable: {message}"
|
|
45
|
+
console.print(f"[red]Error: {message}[/]")
|
|
46
|
+
raise typer.Exit(1) from e
|
|
47
|
+
|
|
48
|
+
return wrapper
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def get_reader(config_path: Path | None = None):
|
|
52
|
+
"""Return an (AuditReader, config) tuple over the configured audit sources."""
|
|
53
|
+
from compliance_aiops.config import load_config
|
|
54
|
+
from compliance_aiops.connection import get_reader as _build
|
|
55
|
+
|
|
56
|
+
cfg = load_config(config_path)
|
|
57
|
+
return _build(cfg), cfg
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def dry_run_print(*, operation: str, api_call: str, parameters: dict | None = None) -> None:
|
|
61
|
+
"""Print a dry-run preview of the API call that would be made."""
|
|
62
|
+
console.print("\n[bold magenta][DRY-RUN] No changes will be made.[/]")
|
|
63
|
+
console.print(f"[magenta] Operation: {operation}[/]")
|
|
64
|
+
console.print(f"[magenta] API Call: {api_call}[/]")
|
|
65
|
+
for k, v in (parameters or {}).items():
|
|
66
|
+
console.print(f"[magenta] Param: {k} = {v}[/]")
|
|
67
|
+
console.print("[magenta] Run without --dry-run to execute.[/]\n")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def double_confirm(action: str, resource: str) -> None:
|
|
71
|
+
"""Require two confirmations for a destructive operation."""
|
|
72
|
+
console.print(f"[bold yellow]⚠️ About to: {action} '{resource}'[/]")
|
|
73
|
+
typer.confirm(f"Confirm 1/2: {action} '{resource}'?", abort=True)
|
|
74
|
+
typer.confirm(
|
|
75
|
+
f"Confirm 2/2: really {action} '{resource}'? This may be irreversible.",
|
|
76
|
+
abort=True,
|
|
77
|
+
)
|