Skip to content

Commit 4e91d83

Browse files
authored
feat(governance): add external attestations envelope and veip poc (#89)
This PR introduces external attestation envelope support and the VEIP (Verifiable Execution and Integrity Protocol) synthetic proof-of-concept, vendors RFC 8785 JCS canonicalization, addresses POAM security findings, and tightens test and documentation standards.
1 parent 4c68ed0 commit 4e91d83

99 files changed

Lines changed: 5048 additions & 1962 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[run]
22
branch = true
33
parallel = true
4+
concurrency = multiprocessing
5+
sigterm = true
6+
source = src/
7+
48
omit =
59
src/gateway/protos/*_pb2*.py
610
src/gateway/protos/*_pb2_grpc.py
@@ -11,4 +15,10 @@ omit =
1115

1216
[report]
1317
fail_under = 75
18+
show_missing = true
19+
skip_covered = false
20+
21+
[paths]
22+
source =
23+
src/
1424

.gitignore

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,11 @@ deployment/terraform/tf_output.json
184184
dist/
185185
*.egg-info/
186186

187-
# Temporary files
187+
# Temporary & Local Developer Files (never commit)
188188
/tmp/
189+
tmp/
190+
local/
191+
.local/
189192

190193
# Governance transpiler output — regenerate via PolicyTranspiler
191194
**/generated_actions.py
@@ -234,24 +237,13 @@ mcp-servers/infrastructure/setup.sh
234237
# Copy litellm_config.yaml.example → litellm_config.yaml and fill in values.
235238
litellm_config.yaml
236239

237-
# Roo AI assistant — local state and cache only. The .roo/rules*/ directories
238-
# are tracked (see AGENTS.md at the repository root, which .roo/ points to).
239-
.roo.json
240-
.roo.yaml
241-
.roo.yml
242-
.roorc
243-
.roo-cache/
244-
.roo-state/
245-
.rooignore
246-
247-
# Antigravity (Roo subsystem) — config examples and init scripts
248-
.antigravity/
249-
antigravity.json
250-
antigravity.yaml
251-
antigravity.yml
252-
config/antigravity_mcp_example.json
253-
init_antigravity.sh
240+
# Roo Code AI assistant — local state and cache only (rules are read from AGENTS.md)
241+
.roo*
254242

255243
# AI 600-1 §2.8 — generated SBOM artifact (not committed)
256244
sbom.json
257245
coverage.json
246+
247+
# Local developer/agent instructions (uncommitted overrides)
248+
.agents.local.md
249+
.agents.md

.roo/rules-architect/01-architect-standards.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

.roo/rules-ask/01-ask-standards.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

.roo/rules-code/01-code-standards.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

.roo/rules-commit-convention/commit-convention.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

.roo/rules-debug/01-debug-standards.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

.roo/rules/00-global-standards.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

AGENTS.md

Lines changed: 64 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
1414
This file defines standards for anyone (human or AI coding agent) contributing
1515
to this repository. It is written in the tool-agnostic `AGENTS.md` convention
16-
supported by most AI coding assistants. Tool-specific configuration (e.g. Roo
17-
mode routing) lives under `.roo/` and simply points back here — see
16+
supported natively by most AI coding assistants (including Antigravity, Roo Code,
17+
Cursor, Cline, GitHub Copilot, and Windsurf) — see
1818
[Tool-Specific Configuration](#tool-specific-configuration) at the bottom.
1919

2020
## Table of Contents
@@ -26,9 +26,10 @@ mode routing) lives under `.roo/` and simply points back here — see
2626
5. [Debugging Standards](#debugging-standards)
2727
6. [Compliance Artifact Obligations](#compliance-artifact-obligations)
2828
7. [Architecture & Design Standards](#architecture--design-standards)
29-
8. [Answering Questions About This Repository](#answering-questions-about-this-repository)
30-
9. [Tool-Specific Configuration](#tool-specific-configuration)
31-
10. [Test Execution](#test-execution)
29+
8. [Documentation Standards](#documentation-standards)
30+
9. [Answering Questions About This Repository](#answering-questions-about-this-repository)
31+
10. [Tool-Specific Configuration](#tool-specific-configuration)
32+
11. [Test Execution](#test-execution)
3233

3334
---
3435

@@ -143,20 +144,28 @@ dump the full environment, and mask any credential-shaped value before logging
143144
### Test Execution: Always Use `uv run`
144145

145146
This project is managed with [`uv`](https://docs.astral.sh/uv/) (see `uv.lock`
146-
and `pyproject.toml`). All pytest invocations must be prefixed with `uv run`.
147-
Never invoke `pytest` or `python -m pytest` directly without the `uv run`
148-
prefix — doing so bypasses the project's locked, reproducible environment.
147+
and `pyproject.toml`). All test and verification invocations must be prefixed with `uv run`.
148+
Never invoke `pytest`, `python`, or `python -m pytest` directly without the `uv run`
149+
prefix — doing so bypasses the project's locked, reproducible virtual environment.
150+
151+
When running tests in parallel with `pytest-xdist` (`-n auto`), always launch
152+
the test suite with `--dist=loadfile` to ensure proper test file isolation across workers.
149153

150154
Correct:
151155
```bash
152156
uv run pytest
153-
uv run python -m pytest --cov=src --cov-report=term-missing
157+
uv run pytest tests/ -m "local or unit" -n auto --dist=loadfile --tb=short
158+
uv run pytest tests/test_tls_enforcement.py -v
159+
uv run pytest --cov=src --cov-report=term-missing
160+
uv run python proof/model.py
154161
```
155162

156163
Incorrect (do not suggest):
157164
```bash
158165
pytest
159166
python -m pytest
167+
pytest -n auto # Missing --dist=loadfile and uv run prefix
168+
python proof/model.py
160169
```
161170

162171
This applies to all agents, contributors, and CI documentation examples.
@@ -271,6 +280,16 @@ When modifying STPA source files:
271280

272281
---
273282

283+
## Documentation Standards
284+
285+
Because CAGE is an illustrative reference architecture and not a live production deployment, all repository documentation must strictly adhere to the following principles:
286+
287+
- **No Internal Operational Tracking:** Do not add or maintain documents that track specific internal deployments, incidents, or team progress (e.g., active POAM trackers, rollback procedures for specific migrations, internal implementation status).
288+
- **Illustrative Patterns Only:** Documents that describe operational procedures (like key rotation, deployment rules, or compensating controls) must clearly include a "Reference Architecture Note" stating they are illustrative templates for adopters.
289+
- **Maintainer Independence:** Documentation should be written for an external adopter to adapt, devoid of maintainer-specific internal cloud project names, timestamps, or specific ticket tracking.
290+
291+
---
292+
274293
## Answering Questions About This Repository
275294

276295
When explaining repository concepts, reference the authoritative source
@@ -299,24 +318,50 @@ When asked about secrets or credentials:
299318

300319
## Tool-Specific Configuration
301320

302-
This file is the single source of truth for agent/contributor standards,
303-
following the tool-agnostic `AGENTS.md` convention. Some AI coding assistants
304-
additionally support mode-specific instruction routing; where used, those
305-
configurations point back to this file rather than duplicating its content:
321+
This file is the single authoritative source of truth for agent and contributor standards,
322+
following the open, tool-agnostic `AGENTS.md` convention.
306323

307-
| Tool | Location | Purpose |
324+
All modern AI coding assistants consume `AGENTS.md` natively at the repository root:
325+
326+
| Assistant / Tool | Ingestion Path | Behavior |
308327
|---|---|---|
309-
| Roo Code | `.roo/rules/`, `.roo/rules-<mode>/` | Per-mode (Code/Debug/Ask/Architect) instruction routing; each file is a thin pointer into the relevant section(s) of this document. |
328+
| **Antigravity** | `AGENTS.md` | Ingested natively as global project instructions and behavioral rules. |
329+
| **Roo Code / Cline** | `AGENTS.md` | Ingested automatically into all modes (Code, Architect, Debug, Ask). |
330+
| **Cursor / Copilot / Windsurf** | `AGENTS.md` | Discovered natively at repository root. |
310331

311-
If you use a different AI coding assistant that supports a project-instructions
312-
file (e.g. a tool reading `CLAUDE.md`, `.cursorrules`, or
313-
`.github/copilot-instructions.md`), point it at this file rather than
314-
introducing a parallel, divergent copy of these standards.
332+
If you use a tool that requires a legacy configuration filename (e.g. `CLAUDE.md`, `.cursorrules`, or `.github/copilot-instructions.md`), create a thin symlink or pointer pointing directly back to this file rather than maintaining a divergent copy of these standards.
315333

316334
---
317335

318336
## Test Execution
319337

338+
### Local and Unit Suite (Offline)
339+
340+
The canonical way to run the full local and unit test suite across multiple workers:
341+
342+
```bash
343+
uv run pytest tests/ -m "local or unit" -n auto --dist=loadfile --tb=short
344+
```
345+
Always launch the test suite with `--dist=loadfile` to ensure proper test file isolation across workers.
346+
347+
### Targeted Test Commands Reference
348+
349+
| Scope / Purpose | Canonical Command |
350+
|---|---|
351+
| **Single test file** | `uv run pytest tests/test_tls_enforcement.py -v` |
352+
| **Specific test method** | `uv run pytest tests/test_tls_enforcement.py::TestTlsProtocolStandards::test_default_client_context_minimum_version -v` |
353+
| **Adversarial / Red-team unit tests** | `uv run pytest tests/red_team/ -m "red_team and not integration" -v` |
354+
| **US Federal region posture** | `CAGE_DEPLOYMENT_REGION=US_FED uv run pytest tests/ -m us_fed -v` |
355+
| **EU ECB region posture** | `CAGE_DEPLOYMENT_REGION=EU_ECB uv run pytest tests/ -m eu_ecb -v` |
356+
| **APAC MAS region posture** | `CAGE_DEPLOYMENT_REGION=APAC_MAS uv run pytest tests/ -m apac_mas -v` |
357+
| **No-Direct-Bind BFS model proof** | `uv run python proof/model.py && uv run pytest tests/test_no_direct_bind_proof.py -v` |
358+
| **Distributed CBF formal proof** | `uv run python -m proof.distributed_cbf_model && uv run pytest proof/distributed_cbf_model.py -v` |
359+
| **Static analysis & formatting** | `uv run ruff check . && uv run ruff format --check .` |
360+
| **Type checking** | `uv run mypy src/` |
361+
| **Bandit SAST security scan** | `uv run bandit -r src/ -c pyproject.toml -ll` |
362+
| **STPA artifact freshness** | `uv run python scripts/check_stpa_freshness.py --verbose` |
363+
| **Langfuse posture validation** | `uv run python scripts/verify_langfuse_posture.py --dry-run --posture development` |
364+
320365
### Full Integration Suite Against Live GKE
321366

322367
The canonical way to run the full integration test suite against the live GKE dev cluster:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1111

1212
### Added
1313

14+
- `tests/test_tls_enforcement.py` — Gateway TLS enforcement test suite: unit assertions for NIST SP 800-52 Rev. 2 TLS 1.2+ protocol minimums, OIDC JWKS `verify=True` transport security, and Linkerd mTLS manifest annotations (`test(compliance)`, closes POAM-2026-011)
15+
- `docs/operations/KEY_ROTATION.md` — Cryptographic key management & rotation guide: documented rotation cadences for Cloud KMS HSM keys (90-day), HMAC routing seal secrets (30-day), and Linkerd mTLS certs with zero-downtime procedures and emergency revocation runbooks (`docs(operations)`, closes POAM-2026-012)
16+
- `deployment/k8s/` manifests — Pinned third-party container image tags: `openpolicyagent/opa:0.68.0-static`, `redis/redis-stack-server:7.4.0-v1`, and `anchore/syft:v1.10.0` across deployment manifests (`feat(infra)`, closes POAM-2026-013)
17+
- `AGENTS.md` — Parallel test isolation standards: added mandatory `--dist=loadfile` flag requirement and targeted test command reference matrix (`docs(tests)`)
1418
- `src/gateway/governance/symbolic_governor.py` — PAUSE handler in `validate_action()`: first-class runtime execution path returning `verdict: PAUSE`, pause token, resume endpoint, and retry metadata (`feat(governance)`)
1519
- `src/gateway/governance/routing_seal.py` — HMAC Routing Seal v2: 4-tuple format `<expire_hex>.<action_slug>.<record_hash_hex>.<hmac_hex>` binding SHA-256 evidence record hash with fail-closed actuator enforcement (`feat(governance)`)
1620
- `src/gateway/governance/cbf.py` — Strict replication rollback & cold-start epoch seed: synchronous Redis `WAIT` verification with fail-closed automatic rollback on replica timeout, plus `_fetch_initial_fence_epoch_sync()` startup seeding (`feat(governance)`)

0 commit comments

Comments
 (0)