Skip to content

Commit 1b18170

Browse files
committed
consent-plane: enforce terminal surface envelope
Adds consent-plane/surface.yaml (surface_id=terminal) + a verifier that FAILS CI if the envelope's containment is weakened (proven both ways), + the consent-plane-surface workflow. Conforms to socioprophet-agent-standards consent-plane/001 + sourceos-spec isolation-spaces-and-taints.
1 parent 2dbdbb4 commit 1b18170

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Consent Plane Surface
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
jobs:
7+
verify:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v5
12+
with: { python-version: '3.x' }
13+
- run: pip install pyyaml
14+
- run: python3 consent-plane/verify_surface.py

consent-plane/surface.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Consent-plane surface envelope. Conforms to socioprophet-agent-standards
2+
# consent-plane/001 + sourceos-spec isolation-spaces-and-taints. Enforced by
3+
# consent-plane/verify_surface.py (consent-plane-surface CI).
4+
surface_id: terminal
5+
conforms_to: socioprophet-agent-standards/standards/consent-plane/surfaces_v1.yaml#terminal
6+
purposes: [discover, implement, verify]
7+
deny_purposes: [egress, operate] # a terminal must not egress or operate live infra
8+
data_classes: [source-and-config, first-party-source]
9+
space_deny: [kernel-space, system-space] # no OS-core / infra ring from a shell

consent-plane/verify_surface.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env python3
2+
"""Enforce this repo's consent-plane surface envelope (fail-closed).
3+
4+
Reads consent-plane/surface.yaml and asserts the hard invariants for its
5+
surface_id, so CI FAILS if the surface's containment is weakened. Conforms to
6+
socioprophet-agent-standards consent-plane/001 + sourceos-spec
7+
isolation-spaces-and-taints. Proven both ways by consent-plane/self_test.py.
8+
"""
9+
from __future__ import annotations
10+
import sys
11+
from pathlib import Path
12+
try:
13+
import yaml # type: ignore
14+
except Exception as exc: # pragma: no cover
15+
raise SystemExit("PyYAML is required (pip install pyyaml)") from exc
16+
17+
# Minimum containment each surface MUST assert (subset checks).
18+
EXPECTED = {
19+
"terminal": {"deny_purposes": {"egress", "operate"},
20+
"space_deny": {"kernel-space", "system-space"}},
21+
"notes": {"deny_purposes": {"egress", "operate"},
22+
"space_deny": {"kernel-space", "system-space", "data-namespace"},
23+
"consent_required": "per-purpose"},
24+
"browser": {"deny_purposes": {"implement", "operate"},
25+
"space_deny": {"kernel-space", "system-space", "user-space", "data-namespace"},
26+
"untrusted_input": True},
27+
}
28+
29+
def main() -> int:
30+
cfg = Path(__file__).resolve().parent / "surface.yaml"
31+
cp = yaml.safe_load(cfg.read_text()) or {}
32+
sid = cp.get("surface_id")
33+
errors: list[str] = []
34+
if sid not in EXPECTED:
35+
print(f"ERR: unknown surface_id {sid!r} (expected one of {sorted(EXPECTED)})", file=sys.stderr)
36+
return 1
37+
exp = EXPECTED[sid]
38+
for key, want in exp.items():
39+
got = cp.get(key)
40+
if isinstance(want, set):
41+
have = set(got or [])
42+
if not want <= have:
43+
errors.append(f"{key} must include {sorted(want)}; missing {sorted(want - have)}")
44+
else:
45+
if got != want:
46+
errors.append(f"{key} must be {want!r}, got {got!r}")
47+
if errors:
48+
print(f"FAIL: {sid} surface envelope violated:", file=sys.stderr)
49+
for e in errors: print(f" - {e}", file=sys.stderr)
50+
return 1
51+
print(f"OK: {sid} surface envelope holds ({', '.join(exp)}).")
52+
return 0
53+
54+
if __name__ == "__main__":
55+
sys.exit(main())

0 commit comments

Comments
 (0)