aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / formal / invariants / capability-revocation-v1.toml
| 1 | schema_version = 0 |
| 2 | id = "AIEN.INV.CAP.REVOCATION_CLOSURE.V1" |
| 3 | version = 1 |
| 4 | status = "SEEDED" |
| 5 | |
| 6 | statement = """ |
| 7 | Once a capability is revoked, it is invalid, and every capability descended from it (its children, their \ |
| 8 | children, and so on) is also invalid. An expired capability is invalid. Revoking a capability never makes \ |
| 9 | its ancestors or unrelated capabilities invalid. Validity checks never turn an invalid capability into a \ |
| 10 | valid one.""" |
| 11 | |
| 12 | assumptions = [ |
| 13 | "Cryptographic identity: the signature or MAC binding a capability to its fields is sound. Crypto correctness is not proven here.", |
| 14 | "The capability graph is acyclic and parent links are recorded when a child is derived.", |
| 15 | "Time is supplied by the caller as a single monotone-enough 'now' value; clock correctness is not covered.", |
| 16 | ] |
| 17 | |
| 18 | semantic_types = ["Capability", "CapabilityGraph", "RevocationSet", "Time"] |
| 19 | |
| 20 | oracle_models = ["lean"] |
| 21 | |
| 22 | evidence_requirements = [ |
| 23 | "positive corpus of valid capabilities staying valid after unrelated revocations", |
| 24 | "negative corpus of revoked, descendant-of-revoked, and expired capabilities that must be refused", |
| 25 | "deliberate mutant that skips descendant invalidation, which must not survive", |
| 26 | "existing implementation unit tests keep passing", |
| 27 | ] |
| 28 | |
| 29 | required_counterexamples = ["revoked_token_accepted", "descendant_of_revoked_accepted", "expired_token_accepted"] |
| 30 | |
| 31 | omega_takeover_condition = """ |
| 32 | Omega expresses revocation reachability and expiry as native propositions, accepts the positive corpus, \ |
| 33 | rejects the negative corpus, kills the required counterexample mutants, and emits a canonical proof/evidence \ |
| 34 | identity that the gates consume, with Lean absent.""" |
| 35 | |
| 36 | [[positive_examples]] |
| 37 | name = "sibling_unaffected" |
| 38 | description = "Two children of one parent; one is revoked. The other remains valid." |
| 39 | |
| 40 | [[positive_examples]] |
| 41 | name = "parent_unaffected" |
| 42 | description = "A child is revoked. Its parent remains valid." |
| 43 | |
| 44 | [[negative_examples]] |
| 45 | name = "revoked_itself" |
| 46 | description = "A revoked token is refused." |
| 47 | |
| 48 | [[negative_examples]] |
| 49 | name = "grandchild_of_revoked" |
| 50 | description = "Parent revoked after a grandchild was derived. The grandchild is refused." |
| 51 | |
| 52 | [[negative_examples]] |
| 53 | name = "expired" |
| 54 | description = "Token with now greater than its valid_until is refused." |
| 55 | |
| 56 | [[counterexamples]] |
| 57 | name = "revoked_token_accepted" |
| 58 | description = "A token in the revoked set passes validation." |
| 59 | |
| 60 | [[counterexamples]] |
| 61 | name = "descendant_of_revoked_accepted" |
| 62 | description = "A token with a revoked ancestor passes validation." |
| 63 | |
| 64 | [[counterexamples]] |
| 65 | name = "expired_token_accepted" |
| 66 | description = "A token past its expiry passes validation." |
| 67 | |
| 68 | [[counterexamples]] |
| 69 | name = "revocation_resurrected" |
| 70 | description = "Re-deriving or re-issuing under an existing id clears a revocation." |
| 71 | |
| 72 | [[implementation_surfaces]] |
| 73 | repo = "aien-dev/aienux" |
| 74 | path = "crates/aienos-aegis/src/capability.rs" |
| 75 | kind = "production" |
| 76 | observed_at = "2ee61b4b158a385c5fcf2c925a625ac043babb21" |
| 77 | note = "Rust: CapabilityGraph::revoke and CapabilityGraph::validate_token." |
| 78 | |
| 79 | [[implementation_surfaces]] |
| 80 | repo = "aien-dev/aienux" |
| 81 | path = "native/capability/aienos_capability.c" |
| 82 | kind = "reference" |
| 83 | observed_at = "2ee61b4b158a385c5fcf2c925a625ac043babb21" |
| 84 | note = "C: state_revoke and cascade_revoke over generation slots. Grep-level read only; needs its own review before FORMAL-3." |
| 85 | |
| 86 | [[observations]] |
| 87 | surface = "crates/aienos-aegis/src/capability.rs" |
| 88 | text = """ |
| 89 | revoke(token_id) walks the recorded child map (a stack, no visited set, so it assumes a DAG) and inserts every \ |
| 90 | reached id, including the starting id, into a revoked set. It does not check that the starting id exists; revoking \ |
| 91 | an unknown id just records it. It is idempotent.""" |
| 92 | |
| 93 | [[observations]] |
| 94 | surface = "crates/aienos-aegis/src/capability.rs" |
| 95 | text = """ |
| 96 | validate_token checks, in this order: own id in revoked set (TokenRevoked); every ancestor id reached by following \ |
| 97 | parent_id through the graph's token map is in the revoked set (TokenRevoked); now_utc > valid_until_utc (TokenExpired); \ |
| 98 | signature mismatch (InvalidSignature). The ancestor walk stops silently if an ancestor id is missing from the token map. \ |
| 99 | So revocation is enforced twice: eagerly by revoke's descendant walk and lazily by the ancestor walk at validation.""" |
| 100 | |
| 101 | [[observations]] |
| 102 | surface = "crates/aienos-aegis/src/capability.rs" |
| 103 | text = """ |
| 104 | Because the revocation check precedes the signature check, a token with a forged signature but a revoked id reports \ |
| 105 | TokenRevoked, not InvalidSignature. Both are refusals. Expiry is inclusive: now == valid_until_utc is still valid.""" |
| 106 | |
| 107 | [[observations]] |
| 108 | surface = "crates/aienos-aegis/src/capability.rs" |
| 109 | text = """ |
| 110 | validate_token validates only the token passed in plus revocation state of its ancestors. It does not re-check ancestors' expiry or \ |
| 111 | signatures. In the current derive rule a child's expiry equals its parent's, so an expired ancestor implies an expired child.""" |
| 112 | |
| 113 | [[observations]] |
| 114 | surface = "crates/aienos-aegis/src/capability.rs" |
| 115 | text = """ |
| 116 | derive_child_token inserts into the token map under child_id without checking for an existing entry and does not clear \ |
| 117 | the revoked set. A re-derived child under a previously revoked id therefore stays revoked. Whether that is intended is not documented in the code read.""" |
| 118 | |
| 119 | [[observations]] |
| 120 | surface = "native/capability/aienos_capability.c" |
| 121 | text = """ |
| 122 | Grep-level only. The C authority revokes by cascade over slots (cascade_revoke) and uses generation slots for reuse; \ |
| 123 | its documented behavior is 'revoking an ancestor revokes the descendants'. Not audited line by line for this manifest.""" |
| 124 | |
| 125 | [[observations]] |
| 126 | surface = "PLAN.md section 9 versus code" |
| 127 | text = """ |
| 128 | no divergence found for 'revocation rejects the revoked token', 'revocation invalidates descendants', 'expired capability is invalid' in the Rust code. \ |
| 129 | The C model differs structurally (generation slots, '>=' expiry) and is recorded under the attenuation manifest.""" |