chat-audit-mcp 0.2.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.
- chat_audit_mcp-0.2.0/.github/workflows/publish.yml +63 -0
- chat_audit_mcp-0.2.0/.github/workflows/tests.yml +26 -0
- chat_audit_mcp-0.2.0/.gitignore +10 -0
- chat_audit_mcp-0.2.0/CHANGELOG.md +207 -0
- chat_audit_mcp-0.2.0/LICENSE +21 -0
- chat_audit_mcp-0.2.0/PKG-INFO +16 -0
- chat_audit_mcp-0.2.0/PRIVACY.md +136 -0
- chat_audit_mcp-0.2.0/README.md +1027 -0
- chat_audit_mcp-0.2.0/README.md.readback.txt +683 -0
- chat_audit_mcp-0.2.0/benchmarks/benchmark_jsonl_index.py +141 -0
- chat_audit_mcp-0.2.0/benchmarks/benchmark_source_cache.py +138 -0
- chat_audit_mcp-0.2.0/docs/adapter-spec.md +132 -0
- chat_audit_mcp-0.2.0/docs/contract-and-prompt.md +478 -0
- chat_audit_mcp-0.2.0/docs/contract.md +248 -0
- chat_audit_mcp-0.2.0/docs/evidence-mcp-protocol.md +104 -0
- chat_audit_mcp-0.2.0/docs/evidence-mcp.schema.json +57 -0
- chat_audit_mcp-0.2.0/docs/ideal-alignment-assessment.md +81 -0
- chat_audit_mcp-0.2.0/docs/m8ven-false-positive-report.en.md +146 -0
- chat_audit_mcp-0.2.0/docs/m8ven-false-positive-report.md +146 -0
- chat_audit_mcp-0.2.0/docs/test-records/README.md +59 -0
- chat_audit_mcp-0.2.0/docs/test-records/adapter-and-jsonl-index.md +74 -0
- chat_audit_mcp-0.2.0/docs/test-records/adapter-conformance.md +45 -0
- chat_audit_mcp-0.2.0/docs/test-records/directory-readiness-0.1.7.md +192 -0
- chat_audit_mcp-0.2.0/docs/test-records/egress-intent-0.1.7.md +107 -0
- chat_audit_mcp-0.2.0/docs/test-records/gate-scope-0.1.7.md +68 -0
- chat_audit_mcp-0.2.0/docs/test-records/issue-4.md +73 -0
- chat_audit_mcp-0.2.0/docs/test-records/issue-8.md +45 -0
- chat_audit_mcp-0.2.0/docs/test-records/out-of-band-approval-0.1.7.md +138 -0
- chat_audit_mcp-0.2.0/docs/test-records/parser-normalization.md +34 -0
- chat_audit_mcp-0.2.0/docs/test-records/raw/0.1.6-unittest.txt +114 -0
- chat_audit_mcp-0.2.0/docs/test-records/raw/0.1.7-directory-readiness-unittest.txt +114 -0
- chat_audit_mcp-0.2.0/docs/test-records/raw/0.1.7-egress-intent-unittest.txt +114 -0
- chat_audit_mcp-0.2.0/docs/test-records/raw/0.1.7-gate-scope-unittest.txt +114 -0
- chat_audit_mcp-0.2.0/docs/test-records/raw/0.1.7-out-of-band-approval-unittest.txt +114 -0
- chat_audit_mcp-0.2.0/docs/test-records/raw/0.1.7-review-fixes-unittest.txt +114 -0
- chat_audit_mcp-0.2.0/docs/test-records/raw/0.1.7-unittest.txt +114 -0
- chat_audit_mcp-0.2.0/docs/test-records/review-fixes-0.1.7.md +84 -0
- chat_audit_mcp-0.2.0/docs/test-records/tool-annotations.md +29 -0
- chat_audit_mcp-0.2.0/docs/test-records/trust-gate-0.1.5.md +34 -0
- chat_audit_mcp-0.2.0/docs/test-records/trust-gate-0.1.6.md +83 -0
- chat_audit_mcp-0.2.0/docs/test-records/trust-gate-0.1.7.md +113 -0
- chat_audit_mcp-0.2.0/docs/tool-schemas.json +490 -0
- chat_audit_mcp-0.2.0/docs/trust-gate-contract.md +437 -0
- chat_audit_mcp-0.2.0/imports/.gitkeep +1 -0
- chat_audit_mcp-0.2.0/packages/evidence-mcp/LICENSE +21 -0
- chat_audit_mcp-0.2.0/packages/evidence-mcp/README.md +48 -0
- chat_audit_mcp-0.2.0/packages/evidence-mcp/pyproject.toml +21 -0
- chat_audit_mcp-0.2.0/packages/evidence-mcp/src/evidence_mcp/__init__.py +17 -0
- chat_audit_mcp-0.2.0/packages/evidence-mcp/src/evidence_mcp/completeness.py +142 -0
- chat_audit_mcp-0.2.0/prompts/summarize_chat_range.md +78 -0
- chat_audit_mcp-0.2.0/pyproject.toml +35 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/__init__.py +9 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/approval.py +618 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/approval_cli.py +252 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/m8ven.py +196 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/network/__init__.py +86 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/network/audit.py +90 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/network/egress.py +469 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/network/gate.py +147 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/network/policy.py +223 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/network/untrusted.py +56 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/__init__.py +37 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/base.py +180 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/conformance.py +253 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/mock_csv.py +101 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/qq_base.py +383 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/qq_csv.py +100 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/qq_json.py +195 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/registry.py +145 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/parsers/telegram_json.py +283 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/report_cli.py +302 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/report_render.py +353 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/server.py +1731 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/trust_check.py +446 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/trust_gate.py +880 -0
- chat_audit_mcp-0.2.0/src/chat_audit_mcp/trust_render.py +153 -0
- chat_audit_mcp-0.2.0/tests/__init__.py +1 -0
- chat_audit_mcp-0.2.0/tests/fixtures/ambiguous_export.synthetic.json +1 -0
- chat_audit_mcp-0.2.0/tests/fixtures/qq_export.synthetic.csv +8 -0
- chat_audit_mcp-0.2.0/tests/fixtures/qq_export.synthetic.json +12 -0
- chat_audit_mcp-0.2.0/tests/fixtures/qq_export.synthetic.jsonl +4 -0
- chat_audit_mcp-0.2.0/tests/fixtures/telegram_export.synthetic.json +36 -0
- chat_audit_mcp-0.2.0/tests/fixtures/telegram_export.truncated.synthetic.json +1 -0
- chat_audit_mcp-0.2.0/tests/test_audit.py +86 -0
- chat_audit_mcp-0.2.0/tests/test_audit_fixes.py +314 -0
- chat_audit_mcp-0.2.0/tests/test_egress_allowlist.py +187 -0
- chat_audit_mcp-0.2.0/tests/test_evidence_mcp.py +73 -0
- chat_audit_mcp-0.2.0/tests/test_local_query.py +541 -0
- chat_audit_mcp-0.2.0/tests/test_network_gate.py +111 -0
- chat_audit_mcp-0.2.0/tests/test_no_network.py +137 -0
- chat_audit_mcp-0.2.0/tests/test_out_of_band_approval.py +449 -0
- chat_audit_mcp-0.2.0/tests/test_outbound_request.py +259 -0
- chat_audit_mcp-0.2.0/tests/test_parser_conformance.py +194 -0
- chat_audit_mcp-0.2.0/tests/test_policy.py +151 -0
- chat_audit_mcp-0.2.0/tests/test_qq_parsers.py +163 -0
- chat_audit_mcp-0.2.0/tests/test_report_cli.py +253 -0
- chat_audit_mcp-0.2.0/tests/test_soft_start.py +154 -0
- chat_audit_mcp-0.2.0/tests/test_stdio_handshake.py +160 -0
- chat_audit_mcp-0.2.0/tests/test_telegram_json.py +110 -0
- chat_audit_mcp-0.2.0/tests/test_tool_annotations.py +126 -0
- chat_audit_mcp-0.2.0/tests/test_trust_check.py +314 -0
- chat_audit_mcp-0.2.0/tests/test_trust_gate.py +711 -0
- chat_audit_mcp-0.2.0/tests/test_untrusted.py +53 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Trusted Publishing — no API token is stored in this repository.
|
|
4
|
+
# GitHub exchanges an OIDC token for a short-lived PyPI credential.
|
|
5
|
+
#
|
|
6
|
+
# One-time setup at https://pypi.org/manage/account/publishing/ :
|
|
7
|
+
# PyPI project name : chat-audit-mcp
|
|
8
|
+
# Owner : NickYangSX
|
|
9
|
+
# Repository name : chat-audit-mcp
|
|
10
|
+
# Workflow filename : publish.yml
|
|
11
|
+
# Environment : (leave blank)
|
|
12
|
+
#
|
|
13
|
+
# Publishing is triggered by a version tag, e.g. `git tag v0.2.0 && git push origin v0.2.0`.
|
|
14
|
+
# The tag must match __version__ in src/chat_audit_mcp/__init__.py — checked below.
|
|
15
|
+
# The version number is always chosen by the maintainer; CI never bumps it.
|
|
16
|
+
|
|
17
|
+
on:
|
|
18
|
+
push:
|
|
19
|
+
tags:
|
|
20
|
+
- "v*"
|
|
21
|
+
workflow_dispatch:
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
|
|
26
|
+
jobs:
|
|
27
|
+
publish:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
permissions:
|
|
30
|
+
id-token: write # mandatory for PyPI Trusted Publishing
|
|
31
|
+
contents: read
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v7
|
|
34
|
+
|
|
35
|
+
- uses: actions/setup-python@v7
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.13"
|
|
38
|
+
|
|
39
|
+
- name: Install build tooling
|
|
40
|
+
run: python -m pip install --upgrade build
|
|
41
|
+
|
|
42
|
+
- name: Verify tag matches package version
|
|
43
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
44
|
+
run: |
|
|
45
|
+
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
46
|
+
PKG_VERSION=$(PYTHONPATH=src python -c "from chat_audit_mcp import __version__ as v; print(v)")
|
|
47
|
+
echo "tag version: $TAG_VERSION"
|
|
48
|
+
echo "package version: $PKG_VERSION"
|
|
49
|
+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
|
|
50
|
+
echo "::error::tag version ($TAG_VERSION) does not match __init__.py ($PKG_VERSION). Bump the version yourself, then re-tag."
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
- name: Verify tests before publishing
|
|
55
|
+
run: |
|
|
56
|
+
python -m pip install -e ".[dev]"
|
|
57
|
+
python -m unittest discover tests
|
|
58
|
+
|
|
59
|
+
- name: Build distributions
|
|
60
|
+
run: python -m build
|
|
61
|
+
|
|
62
|
+
- name: Publish to PyPI
|
|
63
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
unittest:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: actions/setup-python@v7
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
- name: Install project and development dependencies
|
|
24
|
+
run: python -m pip install -e ".[dev]"
|
|
25
|
+
- name: Run unit tests
|
|
26
|
+
run: python -m unittest discover tests
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 — 2026-12-04
|
|
4
|
+
|
|
5
|
+
### Out-of-band approval (Ed25519)
|
|
6
|
+
|
|
7
|
+
The gate can now verify that a human signed the exact decision it is about to
|
|
8
|
+
execute, instead of only proving that the approval sequence was followed.
|
|
9
|
+
|
|
10
|
+
- **New `chat-audit-keygen` / `chat-audit-confirm`.** The private key lives on
|
|
11
|
+
the human side, passphrase-encrypted (PKCS8, mode 600); the gate is given only
|
|
12
|
+
a public key via `CHAT_AUDIT_APPROVAL_PUBKEY`. The confirm CLI renders the
|
|
13
|
+
operation, target, verdict, every risk item and the summary, then signs that
|
|
14
|
+
same payload — it never asks a human to sign an opaque hash. Human-readable
|
|
15
|
+
output goes to stderr; stdout carries the proof JSON only.
|
|
16
|
+
- **Three checks, not one.** Signature, hash binding to the stored decision
|
|
17
|
+
(`params_hash` / `verdict_hash` / `decision_id` / `nonce`), and readable
|
|
18
|
+
summary equality. A valid proof lifted onto a different decision, or a
|
|
19
|
+
re-signed payload whose prose contradicts its numbers, is refused with
|
|
20
|
+
`PROOF_MISMATCH`; the decision stays pending.
|
|
21
|
+
- **Fail-closed when a key is configured.** Missing proof → `PROOF_REQUIRED`;
|
|
22
|
+
an unreadable or wrong key → `PROOF_INVALID`. It never silently falls back to
|
|
23
|
+
`agent_callable_tool`.
|
|
24
|
+
- **Proof nonces enter `_used_nonces`.** Ed25519 is deterministic, so replay
|
|
25
|
+
defence cannot rely on "the signature looks different".
|
|
26
|
+
- **New invariant I11**, contract §12.5 (how to enable it, what it does and does
|
|
27
|
+
not prove), six new error codes, and `cryptography>=42` as a runtime
|
|
28
|
+
dependency. That wheel was already pulled in transitively by `mcp`
|
|
29
|
+
(`mcp/server/request_state.py` imports it), so declaring it directly makes an
|
|
30
|
+
existing requirement explicit and pins a floor rather than adding a new
|
|
31
|
+
install burden. `consent_verifiable_by_gate` becomes true only with
|
|
32
|
+
`consent_verification_scope="key_holder_signature"` — a key holder, never a
|
|
33
|
+
verified person.
|
|
34
|
+
- **Audit trail** records `approval_method` and a 16-hex `proof_fingerprint`,
|
|
35
|
+
never the proof itself.
|
|
36
|
+
- **24 new tests** (`tests/test_out_of_band_approval.py`), including the
|
|
37
|
+
readable-field/hash mismatch case.
|
|
38
|
+
|
|
39
|
+
### Outbound intent layer (egress extension)
|
|
40
|
+
|
|
41
|
+
- The egress allowlist gains a two-field intent abstraction —
|
|
42
|
+
`OutboundRequest(action, target)` — so callers state *what* they want (`repo`,
|
|
43
|
+
`package`) rather than passing raw URLs. Two new allowlisted templates:
|
|
44
|
+
`github.repo` (GET repo metadata) and `osv.query` (POST package vulnerability
|
|
45
|
+
lookup; values travel in a JSON body, never the URL). `build_outbound_request`
|
|
46
|
+
validates the action against a whitelist and the target against format regexes
|
|
47
|
+
(`owner/repo`, `ecosystem:name[:version]` with an explicit ecosystem whitelist
|
|
48
|
+
and length/charset bounds on name and version); `resolve_outbound` /
|
|
49
|
+
`execute_outbound` then fetch. Non-GET redirects are refused outright (301/302
|
|
50
|
+
drop the body, 307/308 keep it), so a POST can never silently lose its
|
|
51
|
+
payload.
|
|
52
|
+
|
|
53
|
+
### Fixed: `allow_network` was process-scoped, not call-scoped
|
|
54
|
+
|
|
55
|
+
- `allow_network=true` used to open the process-wide network gate, so "consent
|
|
56
|
+
once" silently meant "consent for the whole process". It is now a call-scoped
|
|
57
|
+
grant revoked when the call ends (contract §5.4, invariant I10), with a
|
|
58
|
+
`gate-scope` test record covering the regression.
|
|
59
|
+
|
|
60
|
+
### Directory readiness
|
|
61
|
+
|
|
62
|
+
Directory-readiness pass. Everything here makes the published snapshot describe
|
|
63
|
+
the real code; no new verdict behaviour.
|
|
64
|
+
|
|
65
|
+
- **Corrected claim: "zero network requests" was no longer true.** The MCP
|
|
66
|
+
instructions and module constant said the package makes no outbound calls,
|
|
67
|
+
but `trust_gate` has had an opt-in outbound path since 0.1.6. Split into
|
|
68
|
+
`CHAT_PARSING_NETWORK_REQUESTS = 0` (the parsing path, still enforced by the
|
|
69
|
+
audit-hook test) plus `TRUST_GATE_OUTBOUND_POLICY` (opt-in, call-scoped,
|
|
70
|
+
allowlisted). README (zh + en), PRIVACY.md and both tool descriptions now say
|
|
71
|
+
which path is which.
|
|
72
|
+
- **Soft start: configuration errors moved from import time to call time.**
|
|
73
|
+
A half-set `SOURCE_COVERAGE_*`, an unsupported `CHAT_PARSER`, an invalid
|
|
74
|
+
`CHAT_SOURCE_TIMEZONE`, or a `CHAT_FILE_NAME` escaping `CHAT_IMPORT_ROOT`
|
|
75
|
+
used to raise during import, so an MCP host (or a directory validator) could
|
|
76
|
+
never reach `initialize` / `tools/list`. The same misconfiguration now
|
|
77
|
+
surfaces as `discovery.status="unconfigured"` or `SOURCE_UNCONFIGURED`.
|
|
78
|
+
Fail-closed is unchanged: no source file is opened on that path.
|
|
79
|
+
- **Annotations confirm the outbound side effect.** `trust_gate` keeps
|
|
80
|
+
`read_only=false`, `idempotent=false`, `open_world=true`, and its description
|
|
81
|
+
now names `allow_network` and the outbound condition; `resolve_decision`
|
|
82
|
+
stays `open_world=false` because it only changes process-local state. Neither
|
|
83
|
+
is marked read-only to look better in a review.
|
|
84
|
+
- **Added `PRIVACY.md`** (required by the Claude and OpenAI directories):
|
|
85
|
+
data processed, where it stays, the one opt-in outbound path, the metadata
|
|
86
|
+
that cannot be hidden, retention, credentials, and user controls.
|
|
87
|
+
- **Added `[project.urls]`** so directory checks can cross-reference the
|
|
88
|
+
project, and fixed the README version (said 0.1.4, actually 0.1.7).
|
|
89
|
+
- **Fixed the shipped tool contract.** `docs/tool-schemas.json` declared only
|
|
90
|
+
the two parsing tools while README pointed at it as the complete contract — a
|
|
91
|
+
stale document that says "2 tools" no matter which commit is read. It now
|
|
92
|
+
declares all four tools, plus the new `SOURCE_UNCONFIGURED` /
|
|
93
|
+
`source_unconfigured` / `discovery.status="unconfigured"` values.
|
|
94
|
+
- **Handshake tests.** `tests/test_stdio_handshake.py` spawns the real entry
|
|
95
|
+
point and speaks raw JSON-RPC over stdio, so "a host can start this server and
|
|
96
|
+
list its tools" is a verified claim rather than a manual check.
|
|
97
|
+
|
|
98
|
+
## 0.1.7 — 2026-12-03
|
|
99
|
+
|
|
100
|
+
Fixes five review findings, four of them behaviour and one of them an
|
|
101
|
+
over-claim. The over-claim is the important one.
|
|
102
|
+
|
|
103
|
+
- **Corrected claim: the degraded path cannot constrain the Agent.**
|
|
104
|
+
`resolve_decision` is an MCP tool and only an Agent can call an MCP tool, so
|
|
105
|
+
the Agent can approve its own block. The token enforces sequence and
|
|
106
|
+
auditability, not human authorship. `consent_provenance:
|
|
107
|
+
"mcp:resolve_decision"` was replaced by honest values —
|
|
108
|
+
`agent_callable_tool` / `host_elicitation_handler` — plus a constant
|
|
109
|
+
`consent_verifiable_by_gate: false` and a `consent_note` on approval. Contract,
|
|
110
|
+
README and both MCP tool descriptions say this out loud.
|
|
111
|
+
- **Fixed: resume replaced the approved verdict.** Resume re-queried the source
|
|
112
|
+
and returned a fresh verdict, so a source that improved from F to A after
|
|
113
|
+
approval would come back `pass` with `human_approved=true`. The decision now
|
|
114
|
+
stores `verdict_obj` and resume replays it (`verdict_source:
|
|
115
|
+
"decision_snapshot"`) with no second outbound request; a missing snapshot
|
|
116
|
+
fails closed.
|
|
117
|
+
- **Fixed: silent fallback into the soft path.** `ELICITATION_UNSUPPORTED` was
|
|
118
|
+
defined but never emitted. Both fallback reasons are now audited as
|
|
119
|
+
`elicitation_degraded` (`handler_not_injected` / `mode_off`).
|
|
120
|
+
- **Fixed: caller error reported as human denial.** An unknown decision action
|
|
121
|
+
raised `HUMAN_DENIED`; it now raises `INVALID_DECISION_ACTION`.
|
|
122
|
+
- **Fixed: `params` could shadow the real target.** Reserved keys (`target`,
|
|
123
|
+
`operation`) are rejected with `PARAMS_RESERVED_KEY` before any outbound call,
|
|
124
|
+
so the displayed source can no longer diverge from the hashed one.
|
|
125
|
+
- New contract invariants **I8** (replay the approved verdict) and **I9** (never
|
|
126
|
+
claim a verified human). 14 new tests; trust-gate suite 47, full suite
|
|
127
|
+
**176 passed**, no regressions.
|
|
128
|
+
|
|
129
|
+
## 0.1.6 — 2026-12-03
|
|
130
|
+
|
|
131
|
+
- Move the trust verdict onto the MCP surface as a gate that is also the only
|
|
132
|
+
outbound proxy: `trust_gate` evaluates and forwards, `resolve_decision` is
|
|
133
|
+
the only path that issues a `decision_token`. A `block` result returns
|
|
134
|
+
`status="awaiting_human"` with `decision_token=null` and does not hand back
|
|
135
|
+
the payload that triggered it.
|
|
136
|
+
- `decision_token` is HMAC-signed over `(decision_id, operation, params_hash)`,
|
|
137
|
+
single-use, TTL-limited and fail-closed on every anomaly (missing, expired,
|
|
138
|
+
bad signature, param mismatch, replay, unknown decision).
|
|
139
|
+
- Two execution modes with honest labels: an injected elicitation handler keeps
|
|
140
|
+
the human brief out of LLM text generation (`verbatim_present=true`); the
|
|
141
|
+
degraded relay marks itself `verbatim_present=false` with a disclaimer and
|
|
142
|
+
never pretends to be a hard guarantee.
|
|
143
|
+
- Non-pass results carry `trust_label.require_warning_prefix=true`, and
|
|
144
|
+
`summarize_chat_range` now enforces that prefix. `CHAT_AUDIT_TRUST_WARN=block`
|
|
145
|
+
optionally escalates warn to a human stop; the default stays "warn passes".
|
|
146
|
+
- The API key stays inside the gate process: it appears in no result, no audit
|
|
147
|
+
line and no error message; audit records a token fingerprint only.
|
|
148
|
+
- 33 new honesty negative-regression tests mapped to contract invariants
|
|
149
|
+
I1–I7; full suite **162 passed**, no regressions. Two real bugs were caught
|
|
150
|
+
and fixed in the process: the verdict was computed over the untrusted
|
|
151
|
+
envelope instead of its payload (every verdict silently became `block`), and
|
|
152
|
+
the elicitation branch called an unimplemented `_approve()`.
|
|
153
|
+
- Add `docs/trust-gate-contract.md` and a test-record index with raw runner
|
|
154
|
+
output.
|
|
155
|
+
|
|
156
|
+
## 0.1.5 — 2026-12-03
|
|
157
|
+
|
|
158
|
+
- Add `chat-audit-trust`, a trust gate that queries the M8ven Tool Trust API
|
|
159
|
+
and returns a project-defined pass/warn/block recommendation with
|
|
160
|
+
grep-style exit codes (0/1/2; 3 = unable to evaluate).
|
|
161
|
+
- Every outbound request goes through a five-piece network barrier: a
|
|
162
|
+
default-deny network gate (explicit `--allow-network` consent), an egress
|
|
163
|
+
allowlist of hard-coded endpoint templates with per-hop redirect checks,
|
|
164
|
+
pre-flight rate limiting plus circuit breaking, structured untrusted-data
|
|
165
|
+
markers on every parsed response, and a one-line JSON audit log on stderr
|
|
166
|
+
that never records API keys.
|
|
167
|
+
- The MCP tools remain fully offline; the barrier lives in the CLI extension
|
|
168
|
+
only, and the CLI defaults to sending nothing without explicit consent.
|
|
169
|
+
- 71 new tests (71 passed) covering the barrier and the verdict rules; full
|
|
170
|
+
suite 128 passed, no regressions.
|
|
171
|
+
|
|
172
|
+
## 0.1.4 — 2026-12-03
|
|
173
|
+
|
|
174
|
+
- Add `chat-audit-report`, a standalone CLI that parses a local export and
|
|
175
|
+
renders a self-contained, print-friendly HTML audit report (completeness
|
|
176
|
+
verdict, six-gate breakdown, source-file SHA-256 with independent
|
|
177
|
+
verification commands, `network = 0` processing declaration).
|
|
178
|
+
- The CLI is a rendering layer over the same query/parsing/completeness logic
|
|
179
|
+
the MCP tools use; it never recomputes a completeness verdict.
|
|
180
|
+
|
|
181
|
+
## 0.1.3 — 2026-12-02
|
|
182
|
+
|
|
183
|
+
- Replace the in-memory SQLite offset index with a pure-Python byte-offset
|
|
184
|
+
index: a frozen `OffsetIndex` dataclass of sorted `(timestamp_us, record)`
|
|
185
|
+
tuples queried with `bisect_left`. A static directory scan misread
|
|
186
|
+
`sqlite3.connect(":memory:")` plus `CREATE TABLE`/`INSERT` as a write side
|
|
187
|
+
effect and flagged the read-only hint; the fix removes the write call instead
|
|
188
|
+
of weakening the annotation, so the read-only claim becomes actually true.
|
|
189
|
+
Cost: the SQL composite index is gone, but queries stay O(log n) via bisect.
|
|
190
|
+
|
|
191
|
+
## 0.1.2 — 2026-12-02
|
|
192
|
+
|
|
193
|
+
- Declare all four MCP tool-annotation hints on both tools: read-only,
|
|
194
|
+
non-destructive, idempotent, and open-world.
|
|
195
|
+
- Add name-based tool discovery tests covering both registered tools.
|
|
196
|
+
|
|
197
|
+
## 0.1.1 — 2026-11-30
|
|
198
|
+
|
|
199
|
+
- Validate parser declarations while building the registry; invalid streaming or
|
|
200
|
+
byte-offset capabilities now fail during import/registration.
|
|
201
|
+
- Use one computed page boundary for SQLite offset-index selection and response
|
|
202
|
+
paging.
|
|
203
|
+
- Clarify that `records_scanned_this_call` on a cache miss describes the full
|
|
204
|
+
index-building scan, while `indexed_records_read_this_call` describes page
|
|
205
|
+
rereads.
|
|
206
|
+
- Include QQ JSONL/NDJSON streaming and metadata-only byte-offset indexing, the
|
|
207
|
+
adapter conformance suite, and its synthetic benchmark.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 chat-audit-mcp contributors
|
|
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,16 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: chat-audit-mcp
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Read-only local chat export parser exposed as MCP tools
|
|
5
|
+
Project-URL: Homepage, https://github.com/NickYangSX/chat-audit-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/NickYangSX/chat-audit-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/NickYangSX/chat-audit-mcp/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/NickYangSX/chat-audit-mcp/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Privacy, https://github.com/NickYangSX/chat-audit-mcp/blob/main/PRIVACY.md
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Requires-Dist: cryptography>=42
|
|
13
|
+
Requires-Dist: mcp<3.0,>=2.0
|
|
14
|
+
Requires-Dist: tzdata>=2024.1
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: mcp[cli]<3.0,>=2.0; extra == 'dev'
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Privacy Policy — chat-audit-mcp
|
|
2
|
+
|
|
3
|
+
Last updated: 2026-12-04
|
|
4
|
+
|
|
5
|
+
This policy describes what `chat-audit-mcp` does with data. It is written to be
|
|
6
|
+
checkable against the code, not to sound reassuring. Where a guarantee has a
|
|
7
|
+
limit, the limit is stated.
|
|
8
|
+
|
|
9
|
+
## 1. Scope
|
|
10
|
+
|
|
11
|
+
`chat-audit-mcp` is a **local MCP server**. It runs as a child process of your
|
|
12
|
+
MCP host, speaks stdio, and has no server-side component. There is no account,
|
|
13
|
+
no sign-up, no cloud sync, and no vendor-operated backend that could receive
|
|
14
|
+
your data.
|
|
15
|
+
|
|
16
|
+
## 2. What it processes
|
|
17
|
+
|
|
18
|
+
Only what you point it at:
|
|
19
|
+
|
|
20
|
+
- A local chat export file you choose (`CSV`, `JSON`, `JSONL`/`NDJSON`, or
|
|
21
|
+
Telegram JSON), located under `CHAT_IMPORT_ROOT`.
|
|
22
|
+
- Optional configuration from environment variables (`CHAT_FILE_NAME`,
|
|
23
|
+
`CHAT_PARSER`, `CHAT_SOURCE_TIMEZONE`, `SOURCE_COVERAGE_START` /
|
|
24
|
+
`SOURCE_COVERAGE_END`, `CHAT_SOURCE_ID`, `CHAT_ID`, `CHAT_NAME`,
|
|
25
|
+
`CHAT_PLATFORM`).
|
|
26
|
+
|
|
27
|
+
It does not read client memory, decrypt databases, touch `.bak` files, or scan
|
|
28
|
+
directories you did not configure.
|
|
29
|
+
|
|
30
|
+
## 3. Where processing happens
|
|
31
|
+
|
|
32
|
+
Entirely in the server process on your machine. Message parsing, filtering,
|
|
33
|
+
pagination, completeness assessment, and HTML report rendering are local
|
|
34
|
+
operations.
|
|
35
|
+
|
|
36
|
+
## 4. What leaves the machine
|
|
37
|
+
|
|
38
|
+
**Default: nothing.** The chat-parsing path has no network code — no sockets,
|
|
39
|
+
no HTTP, no telemetry, no analytics, no update checks. A regression test runs
|
|
40
|
+
the parsing tools under an OS-level audit hook and fails on any socket or write
|
|
41
|
+
event (`tests/test_no_network.py`).
|
|
42
|
+
|
|
43
|
+
**The single opt-in exception** is the `trust_gate` tool. It contacts an
|
|
44
|
+
external service only when the caller passes `allow_network=true`, and that
|
|
45
|
+
consent covers one call and is revoked when the call returns. When it does run,
|
|
46
|
+
what is sent is a **target identifier only**:
|
|
47
|
+
|
|
48
|
+
| Endpoint | Sent | Never sent |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `m8ven.ai` | the repo URL or `owner/repo` under check | message bodies, speaker names, timestamps, file paths |
|
|
51
|
+
| `api.github.com` | `owner/repo` | same |
|
|
52
|
+
| `api.osv.dev` | `ecosystem:name[:version]` for a package | same |
|
|
53
|
+
|
|
54
|
+
The request is built from an `OutboundRequest` value that structurally has only
|
|
55
|
+
two fields, `action` and `target` (see `docs/ideal-alignment-assessment.md` and
|
|
56
|
+
`docs/test-records/`). Chat content is not part of the request-construction
|
|
57
|
+
input set. This is enforced by a test that inspects the dataclass fields.
|
|
58
|
+
|
|
59
|
+
**What cannot be avoided by any networked design**: even an abstract request
|
|
60
|
+
reveals destination host, timing, frequency, and your IP address to that host,
|
|
61
|
+
and to anyone on the network path. If that metadata matters for your threat
|
|
62
|
+
model, do not use `trust_gate` — the parsing tools work fully offline.
|
|
63
|
+
|
|
64
|
+
## 5. Retention
|
|
65
|
+
|
|
66
|
+
- **No server-side storage.** Nothing is uploaded or stored by the project.
|
|
67
|
+
- **In-memory parse cache**: parsed records may be cached in process memory for
|
|
68
|
+
up to 120 seconds to serve pagination. It disappears when the process exits.
|
|
69
|
+
- **Reports** written by `chat-audit-report` contain metadata only (boundaries,
|
|
70
|
+
counts, completeness basis, verdicts). Message bodies are not written into
|
|
71
|
+
the report.
|
|
72
|
+
- **Audit logs** go to **stderr** and contain metadata only: tool name, timing,
|
|
73
|
+
query identifiers, result counts, completeness status. Message bodies and
|
|
74
|
+
source file paths are not logged (`source_file_path_logged: false`). Your host
|
|
75
|
+
decides where stderr goes and how long it is kept.
|
|
76
|
+
|
|
77
|
+
## 6. Credentials
|
|
78
|
+
|
|
79
|
+
- **No API key is required** and none is bundled. There are no hardcoded
|
|
80
|
+
secrets in the source tree.
|
|
81
|
+
- `M8VEN_API_KEY` is **optional**. If set, it is read into memory to
|
|
82
|
+
authenticate to `m8ven.ai`. It is never written to a result, a log line, or
|
|
83
|
+
an error message.
|
|
84
|
+
- **Approval keys stay on your machine.** `chat-audit-keygen` writes an
|
|
85
|
+
Ed25519 private key encrypted with your passphrase (mode 600); it is never
|
|
86
|
+
sent anywhere, and the gate only ever receives the public key path
|
|
87
|
+
(`CHAT_AUDIT_APPROVAL_PUBKEY`). A proof is a signature over a decision, not a
|
|
88
|
+
secret, but the audit log still records only a short fingerprint of it.
|
|
89
|
+
- No cookies, no login tokens, no device identifiers, no telemetry.
|
|
90
|
+
|
|
91
|
+
## 7. Third parties
|
|
92
|
+
|
|
93
|
+
When `trust_gate` is used with `allow_network=true`, the target identifier is
|
|
94
|
+
sent to the endpoint named above. Those services apply their own privacy
|
|
95
|
+
policies to what they receive. The project does not control them and does not
|
|
96
|
+
send anything beyond the identifier.
|
|
97
|
+
|
|
98
|
+
## 8. Children
|
|
99
|
+
|
|
100
|
+
Not directed at children. It processes only files an operator explicitly
|
|
101
|
+
configures.
|
|
102
|
+
|
|
103
|
+
## 9. Your controls
|
|
104
|
+
|
|
105
|
+
- **Delete**: remove the source export file and any generated report; nothing
|
|
106
|
+
else is retained.
|
|
107
|
+
- **Stay offline**: never call `trust_gate`, or keep the network gate closed by
|
|
108
|
+
omitting `allow_network=true`. Everything except the trust check works
|
|
109
|
+
without network access.
|
|
110
|
+
- **Limit scope**: set `SOURCE_COVERAGE_START` / `SOURCE_COVERAGE_END` to bound
|
|
111
|
+
the interval the tool will claim coverage for.
|
|
112
|
+
- **Inspect**: every result carries `integrity` and `audit` blocks describing
|
|
113
|
+
what was read and what was not proven.
|
|
114
|
+
|
|
115
|
+
## 10. Changes
|
|
116
|
+
|
|
117
|
+
Material changes to this policy are recorded in `CHANGELOG.md` together with
|
|
118
|
+
the version they ship in. The version is single-sourced in
|
|
119
|
+
`src/chat_audit_mcp/__init__.py`.
|
|
120
|
+
|
|
121
|
+
## 11. Contact
|
|
122
|
+
|
|
123
|
+
Open an issue in the project repository. Do not include chat exports, personal
|
|
124
|
+
data, or credentials in a report.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 中文摘要
|
|
129
|
+
|
|
130
|
+
- **纯本地**:作为 MCP 宿主子进程运行,stdio 通信,无账号、无云端、无遥测。
|
|
131
|
+
- **默认零出站**:聊天解析路径没有任何网络代码,有审计钩子测试守护。
|
|
132
|
+
- **唯一可选出站**:`trust_gate`,仅当调用方传 `allow_network=true`(单次授权),且只发送目标标识符(`owner/repo` 或 `package`),**绝不发送消息正文、发言人、时间戳、文件路径**。
|
|
133
|
+
- **无法避免的元数据**:任何联网都会向对方暴露目标主机、时间、频率和你的 IP。若这构成风险,请不要使用 `trust_gate`,其余功能完全离线可用。
|
|
134
|
+
- **不留存**:无服务端存储;进程内解析缓存最长 120 秒,退出即消失;报告只含元数据;审计日志走 stderr 且不含正文和文件路径。
|
|
135
|
+
- **无必需凭据**:`M8VEN_API_KEY` 可选,仅驻留内存,不进结果、不进日志、不进报错。
|
|
136
|
+
- **你的控制**:删本地文件即删除一切;不联网即完全离线;可用 `SOURCE_COVERAGE_*` 限定区间。
|