interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / formal / invariants / capability-attenuation-v1.toml

150 lines · 7710 bytes Raw Blame History
1schema_version = 0
2id = "AIEN.INV.CAP.ATTENUATION.V1"
3version = 1
4status = "SEEDED"
5
6statement = """
7A valid delegated child capability never possesses authority that its valid parent does not possess. \
8Concretely: the child's scope is contained in the parent's scope; the child's expiry is no later than \
9the parent's expiry; the child's remaining delegation depth is strictly less than the parent's; and a \
10capability with zero remaining delegation depth cannot delegate. Delegation from an invalid parent \
11(expired or revoked) is refused."""
12
13assumptions = [
14 "Cryptographic identity: the signature or MAC binding a capability to its fields is sound and the signing secret is not leaked. Crypto correctness is not proven here.",
15 "The capability graph has no cycles (parents are created before children).",
16 "A scope containment relation exists per scope kind and is the single definition of 'authority subset'.",
17]
18
19semantic_types = ["Capability", "Scope", "Expiry", "DelegationDepth", "Holder", "CapabilityGraph"]
20
21oracle_models = ["lean"]
22
23evidence_requirements = [
24 "positive corpus of accepted delegations",
25 "negative corpus of refused delegations",
26 "deliberate privilege-expansion mutant that must not survive",
27 "differential agreement between Rust and C implementations on the shared corpus where their models overlap",
28 "existing implementation unit tests keep passing",
29]
30
31required_counterexamples = ["scope_expansion", "expiration_extension", "delegation_depth_increase"]
32
33omega_takeover_condition = """
34Omega expresses the containment, expiry, and depth relations as native propositions, accepts the positive \
35corpus, rejects the negative corpus, kills the required counterexample mutants, and emits a canonical \
36proof/evidence identity that the gates consume, with Lean absent."""
37
38[[positive_examples]]
39name = "narrower_filesystem_prefix"
40description = "Parent holds a filesystem scope for /a; child asks for /a/b with depth one lower and the same expiry. Accepted."
41
42[[positive_examples]]
43name = "read_only_from_read_write"
44description = "Parent holds read-write filesystem scope; child asks for read-only on the same prefix. Accepted."
45
46[[positive_examples]]
47name = "equal_scope"
48description = "Child scope equals parent scope. Accepted (containment is non-strict)."
49
50[[negative_examples]]
51name = "write_from_read_only"
52description = "Parent filesystem scope is read-only; child asks for read-write. Refused."
53
54[[negative_examples]]
55name = "delegate_at_depth_zero"
56description = "Parent has delegation depth zero. Any child derivation is refused."
57
58[[negative_examples]]
59name = "different_scope_kind"
60description = "Parent is a Network scope, child asks for a Filesystem scope. Refused (only a system-admin parent contains every kind)."
61
62[[counterexamples]]
63name = "scope_expansion"
64description = "A child whose scope is not contained in the parent's is accepted (wider path, wider host, higher token or depth limit, write from read-only)."
65
66[[counterexamples]]
67name = "expiration_extension"
68description = "A child that outlives its parent is accepted."
69
70[[counterexamples]]
71name = "delegation_depth_increase"
72description = "A child with remaining delegation depth greater than or equal to the parent's is accepted, or a depth-zero parent delegates."
73
74[[counterexamples]]
75name = "invalid_parent_delegates"
76description = "An expired or revoked parent successfully derives a child."
77
78[[implementation_surfaces]]
79repo = "aien-dev/aienux"
80path = "crates/aienos-aegis/src/capability.rs"
81kind = "production"
82observed_at = "2ee61b4b158a385c5fcf2c925a625ac043babb21"
83note = "Rust AEGIS capability graph: CapabilityScope::contains, CapabilityGraph::derive_child_token."
84
85[[implementation_surfaces]]
86repo = "aien-dev/aienux"
87path = "native/capability/aienos_capability.c"
88kind = "reference"
89observed_at = "2ee61b4b158a385c5fcf2c925a625ac043babb21"
90note = "C capability authority (rights bitmask, generation slots). A different model from the Rust one; read only by grep for this manifest, not audited. Needs its own review before FORMAL-3."
91
92[[observations]]
93surface = "crates/aienos-aegis/src/capability.rs"
94text = """
95CapabilityToken fields: id, parent_id (optional), issuer, holder, scope, delegation_depth (u32), \
96valid_until_utc (u64), signature (32 bytes, HMAC-SHA256 over the other fields under a graph master secret)."""
97
98[[observations]]
99surface = "crates/aienos-aegis/src/capability.rs"
100text = """
101derive_child_token takes no expiry or depth argument. The child always gets valid_until_utc equal to the \
102parent's and delegation_depth equal to parent depth minus one. So 'child expiry <= parent expiry' holds by \
103construction as equality, and 'child depth < parent depth' holds by construction as exactly one less."""
104
105[[observations]]
106surface = "crates/aienos-aegis/src/capability.rs"
107text = """
108derive_child_token order: look up parent (TokenNotFound), validate parent (revoked, ancestor revoked, \
109expired, bad signature), refuse if parent depth is 0 (DelegationDepthExceeded), refuse if \
110parent.scope.contains(child_scope) is false (ScopeExceeded). The holder argument is not checked against \
111the parent's holder; AegisError::UnauthorizedAgent exists but derive_child_token does not return it."""
112
113[[observations]]
114surface = "crates/aienos-aegis/src/capability.rs"
115text = """
116CapabilityScope::contains (the subset relation), per kind: SystemAdmin contains everything. Filesystem: \
117child path_within parent prefix (lexical, absolute, no '..' components) and (read_only equal, or child is \
118read_only). Network: host equal or parent '*', and port equal or parent port 0. Model: model_name equal or \
119parent '*', and child max_tokens <= parent. World: child max_depth <= parent. StandingFetch: host equal or \
120parent '*'. Custom: namespace equal and (action equal or parent '*'). Any other pair is false. In particular \
121Device scope has no arm, so a Device parent contains no Device child (only a SystemAdmin parent does), and \
122a SystemAdmin child is contained only by a SystemAdmin parent."""
123
124[[observations]]
125surface = "crates/aienos-aegis/src/capability.rs"
126text = """
127Expiry is inclusive of the boundary: a token is expired when now_utc > valid_until_utc, so now == valid_until_utc is still valid."""
128
129[[observations]]
130surface = "crates/aienos-aegis/src/capability.rs"
131text = """
132derive_child_token does not reject a child_id that already exists; the new token replaces the old one in the \
133tokens map and the child id is appended to the parent's child list again. Whether this matters for the invariant \
134is open (it affects identity uniqueness, not attenuation)."""
135
136[[observations]]
137surface = "native/capability/aienos_capability.c"
138text = """
139Grep-level only. The C authority uses a rights bitmask (a child may not set rights its authority lacks: AIENOS_CAP_ERR_AMPLIFY), \
140a fixed maximum chain depth AIENOS_CAP_MAX_DEPTH = 8 counted from the root (not a per-token decreasing counter), \
141and lease_expiry where 0 means no expiry; a child lease may not exceed the authority's lease. Expiry is '>=' there \
142(clock >= lease_expiry is expired), unlike the Rust '>' boundary."""
143
144[[observations]]
145surface = "PLAN.md section 9 versus code"
146text = """
147divergence: the plan states 'child expiration <= parent expiration' and 'child delegation depth < parent delegation depth' as properties to prove. \
148The Rust code satisfies them by construction (equality, and parent minus one). The C code has a different depth model (absolute cap) \
149and a different expiry boundary. The neutral statement therefore says 'no later' and 'strictly less remaining depth' and lists the C model's \
150difference as an open reconciliation item; it is not assumed to be the same rule."""