Skip to content

Commit 7d064f9

Browse files
committed
docs: apply sweep patches, archive v1.2 docs, document Carbon audit & autonomy leases
1 parent 26485db commit 7d064f9

20 files changed

Lines changed: 83 additions & 31 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ All notable changes to Cowrie (`cowrie-ai`) are documented in this file.
88
- **Profile E (Edge) / Profile C (Cloud) Split (`python/cowrie/profiles.py`, `docs/PROFILES.md`):** Separated local workstation and multi-tenant cloud serving into explicit, immutable presets sharing one canonical core.
99
- **Profile E (Edge):** `durable=True` (`fsync` on local `btrfs`/NVMe), `min_statepage_ctx_tokens=4096`, local grammar-gated `B2-b` virtualization (`16 KB`), `A2-Split`, `S3` capsules, and durable single-use nonce ledgers.
1010
- **Profile C (Cloud):** `durable=False` (`/dev/shm` restart/swap or dedicated local NVMe), StatePage hard-gated **OFF** below `32,768` tokens (`65,536` recommended for dense 8B) and hard-gated **OFF** on `overlayfs`, `B2-b` off on cached APIs, and stateless challenge-nonce verification.
11-
- **Scale inversion validated (`receipts/RUN-INDEX.md`):** Confirmed that KV StatePages cross breakeven cleanly at `>= 32K` tokens on both dense (`Llama-3.3-70B-AWQ`) and MoE (`Qwen3.5-35B-A3B-FP8`, `GLM-4.5-Air-AWQ`) models while staying sub-breakeven at short contexts (`<= 16K`) and on `overlayfs`.
11+
- **Scale inversion validated (`receipts/RUN-INDEX.md`):** Confirmed that KV StatePages cross breakeven cleanly at `>= 32K` tokens on both dense (`Llama-3.3-70B-AWQ`, `64/64` parity) and pure-attention MoE (`Mixtral-46.7B-AWQ`, `64/64` parity; `GLM-4.5-Air-AWQ` `PASS_WITH_AWQ_NONDET_CAVEAT`) models while staying sub-breakeven at short contexts (`<= 16K`) and on `overlayfs`. Hybrid `MambaSpec` MoE (`Qwen3.5-35B-A3B`) failed parity (`0/64`) and is now fail-closed.
1212
- **Native V4 vLLM Connector (`adapters/vllm/cowrie_kv_connector.py`):** Self-describing V4 layout with pinned-slab async staging, split durability policy, Profile E/C admission gates (`<32K` and `overlayfs`), and fail-closed `MambaSpec` handling until vLLM exposes exact recurrent-state slot layouts.
1313
- **S3 Semantic Capsules & A2-Split (`python/cowrie/__init__.py`):** Shipped `encode_s3_capsule` / `decode_s3_capsule` for cross-family big-chewer → small-worker knowledge handoff (`+16.7 pp` to `+100 pp` accuracy lift on small workers, `100%` `0x80` taint preservation) and `canonicalize_a2_split` for cache-friendly static/dynamic framing.
1414

‎README.md‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
**16 KB-aligned content-addressed binary container, verified KV StatePages (vLLM V4 / `llama.cpp`), `S3` semantic capsules, Capability V2 provenance runtime, and offline `cowrie verify-bundle` auditor — one zero-dependency Rust/WASM core split cleanly into Edge (`Profile E`) and Cloud (`Profile C`).**
2626

27-
> **Package name note:** Install as **`cowrie-ai`** on PyPI and npm (`Neumenon/cowrie`, Apache-2.0). Bare `cowrie` on PyPI belongs to the unrelated SSH/Telnet honeypot.
27+
> **Package & publish note:** **`cowrie-ai==1.3.0` is published on PyPI** (Apache-2.0), install with `pip install cowrie-ai`. The npm `cowrie-ai` package and crates.io `cowrie-core`/`cowrie-cli` are **not yet published** — build from source for those. Do **not** install bare `cowrie` (unrelated SSH/Telnet honeypot) or the retired legacy packages `cowrie-py`, `cowrie-codec`, or `cowrie-rs` (`Neumenon/cowrie-legacy` codec).
2828
2929
---
3030

@@ -33,7 +33,7 @@
3333
Cowrie `v1.3.0` keeps **one shared canonical core** (`libcowrie_core`, `cowrie` CLI, `cowrie_core.wasm`) and splits runtime policies cleanly across two profiles instead of forcing one setting onto both local workstations and cloud clusters:
3434

3535
### Shared Core (Always On, Apache-2.0, 100% Offline-Verifiable)
36-
- **Canonical `COWR` Wire & Dual-Tree `CWRF` Shards (`canonical.rs`, `shard.rs`):** Bijective, key-order-invariant binary frames (`169.8 ns` zero-alloc verify), 34-byte SHA-256 multihash CIDs, and 16 KB-aligned RFC 6962 Merkle shards.
36+
- **Canonical `COWR` Wire & Dual-Tree `CWRF` Shards (`canonical.rs`, `shard.rs`):** Bijective, key-order-invariant binary frames (`169.8 ns` zero-alloc C verify on 184 B frame, Ryzen 7 7700X, [`receipt_v1_1_hardening.json`](receipts/receipt_v1_1_hardening.json)), 34-byte SHA-256 multihash CIDs, and 16 KB-aligned RFC 6962 Merkle shards.
3737
- **Canonical Prefix Splitting (`A2-Split`):** Lifts KV prefix-cache hit rate from **`0.2% → 85.0%`** (`98.2%–100%` across 5 models with volatile trailer split), **`7.0–12.4×`** faster prefill, **`−27.6%`** prompt tokens, **`0 B`** KV written ([`receipt_exp_a3_canonical_prefix.json`](receipts/receipt_exp_a3_canonical_prefix.json)).
3838
- **Fail-Closed Verified StatePages (`CWSP`):** `verify_hash=True` always on; empty `expected_doc_cid`, empty `expected_runtime_id`, empty `expected_model_sha`, and `verify_hash=False` are rejected unconditionally at the C-ABI boundary (`ERR_INVALID_CONTRACT`).
3939
- **Sticky Provenance, Capability Tokens V2 (`COWRIE_CAP_V2\0`) & Offline Evidence (`verify-bundle`):** Out-of-band `0x80` taint surviving payloads under 16 KB, `B2-b` slices, `A2-Split`, and `S3` capsules; single-use Ed25519 capabilities bound to `(cid, action, tool, canonical_args_hash, destination, session_id, issued_at, short expiry <= 300s, nonce)` with durable `CWNL0002` nonce ledgers & `StatelessChallengeVerifier`; secret-path blocking (including symlinks); pinned MCP `tools/list` rug-pull detection (`-32025`); and **100% offline `cowrie verify-bundle`** verification of `.cwwal` chains, root-signed `TrustBundle` key lifecycles, and V2 signatures.
@@ -58,6 +58,29 @@ Cowrie `v1.3.0` keeps **one shared canonical core** (`libcowrie_core`, `cowrie`
5858

5959
---
6060

61+
## Security Audit, Fixes & Autonomy Leases (Carbon, 2026-11-30)
62+
63+
A three-reviewer Carbon swarm audited `v1.3.0` line by line against the source, not the claims. Seven external findings were triaged — **4 real, 3 partial** — and the audit surfaced additional defects the 205-attack suite had not covered.
64+
65+
**Fixed in `v1.3.0`:**
66+
- **Session taint root (`COWRIE_TAINT_SET_V1`)** — one capability and one signature cover a whole multi-read tainted snapshot; the old path required one Ed25519 signature per tainted CID and deadlocked the stateless verifier.
67+
- **Secret-path normalization** — interior quotes, backslash escapes, `file://localhost/`, allowlist `"/"`, dangling/multi-level symlinks, and `_cowrie_*` argument smuggling to child MCP servers.
68+
- **Bounded JSON parsing and MCP framing** — 64 MiB decoded budget, 65,536-byte key cap, O(1) drain of oversized lines without desynchronising JSON-RPC.
69+
- **Nonce ledger expiry pruning**, `_find_lib()` fail-closed ABI checks, and safe-path enforcement on `COWRIE_LIB`/`COWRIE_LIB_PATH`.
70+
- **vLLM connector** — 3× → 1× Merkle verification per hit, TP>1/PP>1 CID parity (was a 0% hit rate), pinned-slab leak and async D2H use-after-release fixes.
71+
- **`EvidenceBundle` integrity** — revoked keys with `revoked_at == 0`, unsigned Plane C tensors, and unescaped control characters are now refused; `lens.rs` gained a UTF-8 boundary panic fix and an O(N²) → O(N) search.
72+
73+
**Verified:** `tests/test_carbon_audit_regressions.py` **9/9**, security **12/12 classes / 205/205 attacks refused**, Rust **31/31**, full connector, evidence, WASM and conformance suites green. Triage and implementation notes: [`reports/CARBON-AUDIT-TRIAGE.md`](reports/CARBON-AUDIT-TRIAGE.md) · [`reports/CARBON-AUDIT-SUMMARY.md`](reports/CARBON-AUDIT-SUMMARY.md).
74+
75+
**Autonomy leases (`COWRIE_LEASE_V1`)** — bounded autonomy instead of a per-call approval modal:
76+
- **T0** observe (free) · **T1** reversible workspace writes · **T2** shell, network, credentials, deletes, publishing (never covered by a normal lease)
77+
- **Single-use** lease for one action, or a **long lease** bounded by time, actions, bytes, external calls and spend
78+
- Host-pinned workspace root, symlink/`..` escape refusal, executable/config surfaces forced to T2, content-addressed snapshots with `cowrie lease rollback`, durable budgets, checkpoint digest, revocation list, and an optional high-risk T2 co-signature (≤300 s)
79+
- CLI: `cowrie lease issue|verify|revoke|digest|rollback`; proxy flags `--lease`, `--lease-pubkey`, `--workspace-root`, `--lease-state-dir`, `--require-lease`
80+
- Model and threat analysis: [`docs/AUTONOMY-LEASES.md`](docs/AUTONOMY-LEASES.md) · implementation report: [`reports/LEASE-IMPLEMENTATION.md`](reports/LEASE-IMPLEMENTATION.md)
81+
82+
---
83+
6184
## Documentation, Formal Proofs & Receipts
6285

6386
- **Quickstart:** [`docs/QUICKSTART.md`](docs/QUICKSTART.md) — install `cowrie-ai`, CLI, Python `COWR`/`S3`/Capability V2, vLLM plugin check
@@ -75,7 +98,7 @@ Cowrie `v1.3.0` keeps **one shared canonical core** (`libcowrie_core`, `cowrie`
7598
## Quick Install & Verification
7699

77100
```bash
78-
pip install cowrie-ai
101+
pip install cowrie-ai==1.3.0
79102
cowrie --help
80103
python3 -c "import cowrie; print(cowrie.__version__)"
81104
```
@@ -98,7 +121,7 @@ python3 tests/test_evidence_bundle.py # Offline cowrie verify-bundle +
98121

99122
## Ecosystem Connectors
100123

101-
See [`adapters/README.md`](adapters/README.md) and [`ROADMAP.md`](ROADMAP.md) for drop-in integration guides covering **vLLM V1/V4 (`CowrieKVConnectorV1`)**, **`llama.cpp`**, **MCP (`cowrie mcp-proxy`)**, **LangGraph**, **PydanticAI**, **OpenAI Agents SDK**, **ComfyUI**, **Hugging Face Diffusers**, **LanceDB**, **Cloudflare Workers**, and **Eureka LLM / Creative**.
124+
See [`adapters/README.md`](adapters/README.md) and [`ROADMAP.md`](ROADMAP.md) for integration guides covering **vLLM V1/V4 (`CowrieKVConnectorV1`)**, **`llama.cpp`**, **MCP (`cowrie mcp-proxy`)**, **LangGraph**, **PydanticAI**, **OpenAI Agents SDK**, **ComfyUI**, **Hugging Face Diffusers**, **LanceDB**, **Cloudflare Workers**, and **Eureka LLM / Creative**.
102125

103126
---
104127

‎adapters/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cowrie Ecosystem Connectors & Runtime Adapters (`v1.3.0`)
22

3-
Drop-in adapters connecting one zero-dependency Rust/WASM core (`libcowrie_core`, `cowrie` CLI, `cowrie_core.wasm`) into inference engines, agent frameworks, creative pipelines, vector stores, and edge platforms — zero standalone daemons, zero migration.
3+
Runtime adapters connecting one zero-dependency Rust/WASM core (`libcowrie_core`, `cowrie` CLI, `cowrie_core.wasm`) into inference engines, agent frameworks, creative pipelines, vector stores, and edge platforms (note: `cowrie-ai` PyPI/npm packages are pending `v1.3.0` publish — build from source with `make wheel` / `make wasm` until live).
44

55
## Quick Matrix
66

‎adapters/cloudflare-workers/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Cowrie Edge MCP Gateway for Cloudflare Workers
22

3-
Deploy Cowrie's zero-import `cowrie_core.wasm` (`~92 KiB` gzipped, `~0.6 ms` isolate load) as a Cloudflare Worker in front of any Streamable HTTP MCP server or edge AI API:
3+
Deploy Cowrie's zero-import `cowrie_core.wasm` (`~116 KiB` gzipped / `289.7 KiB` raw in `v1.3.0`, zero host imports) as a Cloudflare Worker in front of a Streamable HTTP MCP server or edge AI API:
44

55
- **`POST /mcp`** — Virtualizes oversized (`>= 16 KB`) MCP responses into Mealy-fenced atlases, injects `cowrie_get` for bounded RFC 6901 / grep / line slicing, and blocks unsigned tainted privileged calls with `-32025` at the edge. Backed by **`CowrieMcpSessionDO` (Cloudflare Durable Objects)** in [`wrangler.toml`](wrangler.toml) so virtualized handles and causal `0x80` taint survive global V8 isolate evictions.
66
- **`POST /v1/verify`** — Zero-alloc `COWR` / `CWRF` Merkle verification.
77
- **`POST /v1/lens`** — `R0` / `R1` / `R2` / `R2-Compact` / `virtual-atlas` prompt projection.
8-
- **`POST /v1/declassify/verify`** — Strict RFC 8032 `Ed25519` capability verification.
8+
- **`POST /v1/declassify/challenge`** — Mint single-use HMAC-bound challenge nonces (`StatelessChallengeVerifier`).
9+
- **`POST /v1/declassify/verify`** — Strict RFC 8032 `Ed25519` Capability V2 (`COWRIE_CAP_V2`) verification.
910

1011
## Quickstart
1112

‎adapters/comfyui/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# Cowrie Custom Nodes for ComfyUI
22

3-
Drop-in ComfyUI nodes bringing canonical `CWSP` conditioning caching, `R0–R2-Compact` prompt lenses, and `0x80` + `Ed25519` community-workflow security directly into ComfyUI graphs.
3+
ComfyUI custom nodes bringing canonical `CWSP` conditioning caching, `R0–R2-Compact` prompt lenses, and `0x80` + `Ed25519` Capability V2 (`COWRIE_CAP_V2`) workflow gating into ComfyUI graphs.
44

55
## Install
66

77
```bash
8+
# Once cowrie-ai==1.3.0 is published to PyPI (or install from local wheel via `make wheel`):
89
pip install cowrie-ai
910
ln -s "$(pwd)/adapters/comfyui" /path/to/ComfyUI/custom_nodes/cowrie-comfyui
1011
```
1112

1213
## Nodes Included
1314

1415
1. **`Cowrie Canonical Conditioning Cache (CWSP)`** — Replaces `CLIPTextEncode` with a canonical `COWR` CID + 16 KB `CWSP` NVMe shard cache so ComfyUI restarts and seed/sampler iterations reuse text-encoder outputs immediately (key-order invariant).
15-
2. **`Cowrie Workflow Trust Gate (0x80 + Ed25519)`** — Blocks tainted `net_exfil` / `fs_write` / `shell_exec` actions from untrusted community workflows unless accompanied by an offline RFC 8032 `Ed25519` signature (`cowrie declassify-sign`).
16+
2. **`Cowrie Workflow Trust Gate (0x80 + Ed25519)`** — Blocks tainted `net_exfil` / `fs_write` / `shell_exec` actions from untrusted community workflows unless accompanied by a single-use RFC 8032 `Ed25519` Capability V2 token (`cowrie cap-sign`).
1617
3. **`Cowrie Prompt Lens (R0–R2-Compact)`** — Projects large JSON metadata/annotations into compact, Mealy-fenced LLM/VLM prompt blocks.

‎adapters/diffusers/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Cache expensive text-encoder passes (`UMT5-XXL`, `T5-XXL`, `Qwen3`, `CLIP`) across restarts, seed iterations, and CFG sweeps in 16 KB-aligned, `0600` HMAC/SHA-NI-verified `.state.cowrie` (`CWSP`) shards keyed by canonical `COWR` CIDs (immune to prompt-dict key ordering).
44

5-
## 3-Line Drop-In
5+
## 3-Line Integration
66

77
```python
88
import torch

‎adapters/lancedb/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Keep **LanceDB** as your multimodal vector lakehouse, and use **Cowrie** at the
44

55
1. **Eliminates JSON vector bloat (`−90%+` bytes):** Hoists raw `384–1536d` float lists into compact typed `$tensor` handles (`dtype`, `shape`, `sha256`, `space`).
66
2. **Proves integrity end-to-end:** Seals the retrieved slice in a 16 KB-aligned Merkle-authenticated `CWRF` shard (`verify_shard` catches any 1-bit modification).
7-
3. **Stops RAG prompt injection deterministically (`0x04 -> 0x80`):** Stamps external KB rows `AUTH_UNTRUSTED_EXT`, wraps prompt output in Mealy-escaped fences, and blocks tainted `shell_exec` / `fs_write` / `net_exfil` tool calls unless approved by an RFC 8032 `Ed25519` token.
7+
3. **Enforces provenance & capability gates (`0x04 -> 0x80`):** Stamps external KB rows `AUTH_UNTRUSTED_EXT`, wraps prompt output in Mealy-escaped fences, and gates tainted `shell_exec` / `fs_write` / `net_exfil` tool calls on RFC 8032 `Ed25519` Capability V2 (`COWRIE_CAP_V2`) tokens (not a prompt-injection firewall; see [`docs/SECURITY.md`](../../docs/SECURITY.md)).
88

99
## 6-Line Usage Inside an MCP Tool
1010

‎docs/PROFILES.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ cowrie.apply_profile_env("cloud")
8787
## vLLM Usage with Profiles
8888

8989
```bash
90-
# Cloud serving (>=32K KV StatePages on /dev/shm or dedicated NVMe, never overlayfs)
90+
# Cloud serving (>=32K pure-attention KV StatePages on /dev/shm or dedicated NVMe, never overlayfs;
91+
# hybrid MambaSpec models such as Qwen3.5-35B-A3B fail closed per RETRACTION.md & receipts/RUN-INDEX.md)
9192
COWRIE_PROFILE=cloud \
92-
vllm serve Qwen/Qwen3.5-35B-A3B-FP8 \
93+
vllm serve casperhansen/llama-3.3-70b-instruct-awq \
9394
--enable-prefix-caching \
9495
--kv-transfer-config '{"kv_connector":"CowrieKVConnectorV1","kv_role":"kv_both","kv_connector_extra_config":{"cowrie_state_dir":"/dev/shm/cowrie_kv"}}'
9596
```

‎docs/QUICKSTART.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Install Cowrie (`cowrie-ai`) and verify the bundled native Rust core (`libcowrie
77
## 1. Install
88

99
```bash
10+
# Target PyPI package (pending v1.3.0 publish; until live, build from source via `make wheel` or install a release wheel):
1011
pip install cowrie-ai
1112
# Or from a built release wheel:
1213
pip install dist/cowrie_ai-1.3.0-*.whl
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Cowrie Engineering Guide (`v1.2.0`)
1+
> **Superseded v1.2.0 Guide:** This document reflects the pre-reframe `v1.2.0` surface (including retired `COWRIE_DECLASSIFY_V1`, non-default `CWIV`/`CWZM`, toy 12L `vLLM 0.15.0` proofs, and `26/26` Bend counts). For current `v1.3.0` installation, profiles, security guarantees, and retracted claims, see [`README.md`](../README.md), [`QUICKSTART.md`](QUICKSTART.md), [`PROFILES.md`](PROFILES.md), [`SECURITY.md`](SECURITY.md), and [`RETRACTION.md`](../RETRACTION.md).
22
3-
Cowrie (`v1.2.0`) is a 16 KB-aligned, content-addressed, provenance-tagged binary container and runtime library for AI inference, retrieval, and tool execution. It serves three consumers from one container layout: LLM context windows (`Plane B` lenses), GPU/NVMe DMA pipelines (`Plane C` 16 KB arenas), and CPU integrity and policy verifiers (`Plane A` canonical wire + `Plane D` causal provenance and Merkle roots).
3+
# Cowrie Engineering Guide (`v1.2.0` — Historical Snapshot)
44

5-
Every metric in this guide is backed by a reproducible receipt in [`receipts/`](../receipts/) or `~/tessera-lab/`.
5+
Cowrie (`v1.2.0`) was a 16 KB-aligned, content-addressed, provenance-tagged binary container and runtime library for AI inference, retrieval, and tool execution. It served three consumers from one container layout: LLM context windows (`Plane B` lenses), GPU/NVMe DMA pipelines (`Plane C` 16 KB arenas), and CPU integrity and policy verifiers (`Plane A` canonical wire + `Plane D` causal provenance and Merkle roots).
6+
7+
Historical metrics below reference [`receipts/`](../receipts/) (external local development receipts from `v1.2` are not committed in this repository; see [`receipts/RUN-INDEX.md`](../receipts/RUN-INDEX.md) for the current 73-run `v1.3.0` ledger).
68

79
---
810

0 commit comments

Comments
 (0)