Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/spec/visor-authority.md # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / spec / visor-authority.md` 148 lines · 11036 bytes Raw Blame History Rendered 1 # Omega Visor V1: authority and effect safety (lane 7) 2 3 **Invariant: the Visor can ask. The Visor cannot grant.** 4 5 The Visor may describe an effect and turn it into a request. It cannot mint, 6 revoke, promote, publish or execute, and a request it builds is never 7 authorized. The only things that may act on a request are the existing 8 authority code paths outside the Visor, listed below. 9 10 ## 1. The existing authority path (mapped, not changed) 11 12 | Stage | File | Function(s) | What it decides | 13 |---|---|---|---| 14 | Capability root | `src/runtime/rx_caproot.h/.c` | `rx_caproot_validate`, `rx_caproot_inspect` | Is `(cap_id, generation)` live, current epoch, unexpired, chain intact, for this subject, resource and rights? (`RX_CAP_ERR_BOUNDS/STALE_GEN/REVOKED/EPOCH/SUBJECT/RESOURCE/RIGHTS/...`) | 15 | Root administration | same | `rx_capadmin_mint/revoke/reclaim/advance_clock/bump_epoch` | Only the admin channel holder with the right token and an office authority may change the table (`RX_CAP_ERR_UNAUTHORIZED` otherwise). Reclaim advances the slot generation. | 16 | World check | `src/runtime/rx_world.h`, `rx_world.c` | `rx_world_validate_cap`, `rx_world_inspect_cap` | Same question, routed to the Linux oracle or the native Aienux view (`rx_world_init_with_auth`). | 17 | World publish | same | `rx_world_publish_external` | An outside stimulus needs a cap for `(external_subject, object resource, WRITE)` and a live object ref (`RX_ERR_AUTHORITY`, `RX_ERR_STALE_GEN`). | 18 | AEGIS policy | `src/runtime/rx_aegis.h/.c` | `rx_aegis_evaluate` (pure), `aegis.decide.k` / `root.install.k` reactions | GRANT / DENY (`WHY_NO_RULE`, `WHY_PRIVILEGED`, `WHY_BAD_REQUEST`) / ESCALATE. Only `root.install` mints (through the native Aienux admin). Nothing calls AEGIS; a reaction is simply not ready until its slot holds authority. | 19 | Generation barrier | `src/runtime/rx_generation.h/.c` | `rx_gen_propose`, `rx_gen_add_work`, `rx_gen_promote`, `rx_gen_reject_replay` | Promotion needs `RX_RIGHT_PROMOTE` on `RX_GEN_RES_PROMOTION`; the promoted root records committed external effect ids, and `rx_gen_reject_replay` refuses a recorded id (`RX_GEN_ERR_REPLAY`). | 20 | Design references | `spec/r7-aienos-authority-mapping.md`, `spec/r8-aegis-resident.md` | | Host authority onto the Aienux table; AEGIS resident authority and its attack list. | 21 22 Route of a legitimate effect: 23 `Visor -> EffectIntent -> AEGIS/PHYSICS authority -> bounded execution -> receipt`. 24 The Visor owns only the first arrow. 25 26 ## 2. Adapter contract (`src/visor/visor_effect_request.h/.c`) 27 28 ```c 29 typedef struct { SemanticId effect_id; uint16_t resource_class; uint16_t operation_code; 30 uint32_t capability_slot; uint64_t capability_generation; SemanticId capability_ref; 31 uint16_t param_len; uint8_t param_bytes[128]; uint8_t request_digest[32]; 32 bool authorized; char status[64]; char route[128]; } VisorEffectRequest; 33 int visor_effect_request_build(const OmegaGraph *g, const SemanticId *effect_object_id, VisorEffectRequest *out); 34 int visor_effect_request_classify(const OmegaGraph *g, const SemanticId *id, bool *requires_authority); 35 int visor_effect_request_format_text(const VisorEffectRequest *r, char *out, size_t n); 36 int visor_effect_request_format_json(const VisorEffectRequest *r, char *out, size_t n); 37 ``` 38 39 - **build** reads only an existing `KIND_EFFECT` object. Refuses (-1, output 40 zeroed and unauthorized) when the object is missing or not an effect, 41 `omega_validate_object` rejects it, the payload is not a strict 178-byte 42 v2 effect payload (`omega_effect_read`), 43 `param_len > 128`, it has no id, or `sha256(omega_canonical_encode(obj))` 44 differs from its stored SemanticId (it was edited after being named). 45 It computes the digest into a local buffer and never writes the graph. 46 - `request_digest` = sha256 over the canonical object encoding = the 47 object's SemanticId when the object is intact. 48 - `authorized` is always false, `status` = `UNAUTHORIZED_REQUEST`, `route` 49 as above. There is no setter. The formatters print `authorized: false` as a 50 constant, whatever the struct holds. 51 - **classify** walks relations and payload references (type `elem_type`, 52 value `type_id`, operation types, apply `op_id`/operands, effect 53 `capability_ref`) from `id`. True when it reaches a `KIND_EFFECT` or a TYPE 54 tagged `CAPABILITY_REF / EFFECT_INTENT_REF / EFFECT_RECEIPT_REF`. Returns 55 -1 (and leaves `*requires_authority = true`) when `id` or any non-zero 56 reference is missing: fail closed. 57 - The capability fields are copied as data. The Visor never validates, 58 inspects, resolves or holds a capability. 59 - Physics-free and runtime-free: depends only on `omega_core` (lookup), 60 `omega_canonical`, `omega_validate`, `sha256`. 61 62 ## 3. Hostile test matrix (`tests/visor/test_visor_authority.c`, `make test-visor-authority`) 63 64 The harness plays the authority side (it mints, revokes, promotes); the 65 hostile UI builds requests with the adapter. Every refusal has a positive 66 control through the same call. 67 68 Test conventions, not runtime semantics: resource = `0x7100 + resource_class`; 69 rights: op 1 READ, 2 WRITE, 3 EFFECT, 16 MINT; generation-record effect id = 70 first 8 bytes (little endian) of `request_digest`. 71 72 | # | Attack | Refused by (existing code) | Result | 73 |---|---|---|---| 74 | 1 | Forged cap: random slot | `rx_caproot_validate`, `rx_world_validate_cap` | `BOUNDS` | 75 | 1 | Forged cap: right slot, random generation | `rx_caproot_validate` | `STALE_GEN` | 76 | 1 | Wrong slot (another subject's live cap) | `rx_caproot_validate`, `rx_world_validate_cap` | `SUBJECT` | 77 | 1 | Hostile caller sets `authorized = true` | nothing reads it; root still refuses; formatter prints false | refused | 78 | 2 | Stale generation (revoke, then reclaim) | `rx_caproot_validate`, `rx_world_validate_cap` | `REVOKED`, then `STALE_GEN` | 79 | 3 | Replayed authorization after generation advance | `rx_caproot_validate` (new grant, old ref) and `rx_gen_reject_replay` | `STALE_GEN`, `RX_GEN_ERR_REPLAY` | 80 | 4 | UI direct privileged call | `rx_aegis_evaluate` (`WHY_PRIVILEGED`), `rx_caproot_validate` (`RIGHTS`), `rx_capadmin_mint` under a non-office authority / forged token (`UNAUTHORIZED`) / no channel (`IO`); link check (sec. 4) | refused | 81 | 5 | Malformed request (short / oversized payload, `param_len` > 128, resource 0) | `omega_validate_object` + `visor_effect_request_build` | -1 | 82 | 6 | Operation outside the grant | `rx_caproot_validate` (`RIGHTS`), `rx_aegis_evaluate` (`DENY`, `WHY_NO_RULE`) | refused | 83 | 6 | Resource outside the client's policy | `rx_aegis_evaluate` | `DENY`, `WHY_NO_RULE` | 84 | 7 | Resource changed after authorization | `visor_effect_request_build` digest check (-1); re-identified object has a different digest and `rx_caproot_validate` / `rx_world_validate_cap` return `RESOURCE` | refused | 85 | 8 | Arguments changed after authorization | digest check (-1); re-identified digest differs; changed operation -> `RIGHTS` | params-only: see non-claims | 86 | 9 | Duplicate submission | `rx_gen_reject_replay` after `rx_gen_promote` recorded the effect | `RX_GEN_ERR_REPLAY` | 87 | 10 | Bypass publish: stale / junk / read-only / other subject's cap, stale object | `rx_world_publish_external` | `RX_ERR_AUTHORITY` / `RX_ERR_STALE_GEN` | 88 | 11 | Bypass AEGIS: present a slot nobody granted | `rx_caproot_validate`, `rx_world_validate_cap`; `rx_aegis_evaluate` with no policy -> `DENY` | refused | 89 | 0 | Contract | build/classify never mutate; `authorized` false; formats deterministic; truncation -1; classify fails closed on missing refs | | 90 91 Result on the DGX Spark host (2026-09-28, start commit `ceb68d6`): `PASS 81/81`, 92 `OMEGA_VISOR_AUTHORITY_HOSTILE_PASS`, 4 non-claims printed. 93 After merging main (2026-09-29, 64-bit capability generations): `PASS 84/84` 94 real checks, 20 non-claims (see §5 item 7), `OMEGA_VISOR_AUTHORITY_HOSTILE_PASS`. 95 96 ## 4. Link check (`tests/visor/check_authority_link.sh`, `make visor-authority-check`) 97 98 Runs `nm` over `build/visor/*.o`, `build/language/*.o`, `build/omega_main.o` 99 and `build/omega` (missing files are skipped with a note; an empty 100 `build/visor` fails). It fails when a file: 101 102 - references (undefined) any symbol in `tests/visor/forbidden_symbols.txt`; 103 - references any symbol matching `^rx_`, `^aienos_cap_` or `^rc_` (the omega 104 binary links no runtime at all); 105 - defines a forbidden name (a local reimplementation). 106 107 It also requires `visor_effect_request.o` to export exactly its four public 108 functions, and fails if any Visor source (`src/visor`, `src/language`, 109 `tools/omega.c`) assigns `authorized` anything other than `false`. Success 110 prints `OMEGA_VISOR_AUTHORITY_ISOLATION_PASS`. 111 112 "No authorized setter" is enforced by that export allowlist and source grep, 113 and in the test by file-scope definitions of `visor_effect_request_authorize`, 114 `_grant`, `_submit` and `_set_authorized` that conflict with any declaration 115 of those names in the header. C cannot stop a caller writing the field; the 116 design point is that nothing trusts it. 117 118 ## 5. Explicit non-claims 119 120 1. The capability root binds subject, resource, rights, generation, epoch 121 and lease, not effect parameters. A params-only change validates at 122 `rx_caproot_validate` (observed in the test); only the request digest 123 differs. No existing runtime call compares effect digests. 124 2. The World does not deduplicate external stimuli (observed: the same 125 publish succeeds twice). Duplicate refusal exists only in the generation 126 record of committed external effects (`rx_gen_reject_replay`). 127 3. The typed-result publish gate (`rc_gate_register`, a resident reaction) is 128 not driven; only the World's external publish check is. 129 4. AEGIS is not on a call path. The resident `aegis.decide` / `root.install` 130 reactions are not run; `rx_aegis_evaluate` is exercised as the pure policy 131 function. The native Aienux authority is linked (for `rx_aegis.c`) but 132 validation in this test uses the Linux oracle (`rx_caproot_validate`). 133 5. The operation-code-to-rights and resource-class-to-resource mappings are 134 test conventions. Omega's `EffectPayload` has no canonical mapping to 135 runtime rights yet. 136 6. No effect is executed and no receipt is produced by anything in the Visor. 137 7. **Resolved by spec/effect-cap64-migration.md (was: honest 64-bit 138 generations unrepresentable in the effect format).** Runtime capability 139 generations are 64-bit and seeded from `CLOCK_BOOTTIME` ns << 8, so they 140 exceed 2^32. Omega's `EffectPayload` / `VisorEffectRequest` used to carry a 141 32-bit generation, so every honest reference carried through the Visor was 142 truncated and refused as `STALE_GEN`, and the Visor-path checks printed a 143 NON-CLAIM instead of being counted (before the fix: `PASS 84/84`, 20 144 non-claims). Effect objects are now version 0x02 with a 178-byte 145 big-endian payload carrying the full 64-bit generation; the GEN_FITS gating 146 is removed, every Visor-path check is counted, and case 12 asserts the full 147 generation is carried and validates, and that the same reference cut to 32 148 bits is `STALE_GEN`.