omnet
aien-dev/omnet
Brought by drakestapleton
omnet / qualification / security3-store / README.md
| 1 | # SC1-Q durable framing charges |
| 2 | |
| 3 | Base: current `main`. This rebuild carries `om/quantity` itself (imported from Omega #771), |
| 4 | so nothing here depends on the old `security/3-consumer-enforcement` stack. |
| 5 | This slice is the WORM-owned durable-state side of the SC1-Q row and touches no |
| 6 | transport, revision or comparison function owned elsewhere. |
| 7 | |
| 8 | ## What changed |
| 9 | |
| 10 | `om/store/storepool.om` now charges a record against the store limits with the checked |
| 11 | quantity operations instead of loose integer comparisons: |
| 12 | |
| 13 | | Function | Admitted effect | |
| 14 | |---|---| |
| 15 | | `stbound` | a record length is admitted only inside the fixed 65536 frame buffer | |
| 16 | | `stcharge` | running byte total accumulated with `qadd` up to the 33554432 cap | |
| 17 | | `stcount` | running record count accumulated with `qnext` up to the 65536 cap | |
| 18 | | `stwrite` | one charge of length, total and count before any header, payload or footer write | |
| 19 | | `stnext` | the same three charges before a record is accepted while reading | |
| 20 | |
| 21 | The refusal codes are unchanged (`stwrite` 1 with the poisoned flag, `stnext` -1), so every |
| 22 | existing caller and test keeps its contract. Two differences are deliberate: |
| 23 | |
| 24 | - A charge of `n = 65537` and a total over cap now refuse through the same path instead of |
| 25 | two hand-written comparisons, so a future caller cannot re-derive one and forget the other. |
| 26 | - A running charge below zero is a declared refusal. The previous form cast the counter to |
| 27 | `ulong` directly, which is a checked conversion in Omega and traps; it is not a reachable |
| 28 | store state, but a trap in the middle of a write is a worse answer than a refusal. |
| 29 | |
| 30 | ## Audit of the neighbouring producers, no source change |
| 31 | |
| 32 | Record lengths and counts that reach `stwrite` were traced to their producers before deciding |
| 33 | not to change them: |
| 34 | |
| 35 | - `cmd/tkad/state.om` `dssave` passes `dsget 3`, `dsget 4`, `dssig` and `tkaget` lengths. All of |
| 36 | them are now bounded at the single effect boundary, so a bounded length in `dssave` is |
| 37 | admitted or refused by the same charge and cannot be forgotten there. |
| 38 | - `cmd/tkad/socket.om` takes `ds_ctl 3` from header byte 5 (`gt get h 5 1` refuses anything but |
| 39 | 0/1) and `ds_ctl 4` from header byte 4, a single byte, so the `dsget 3`/`dsget 4` loops in |
| 40 | `dssave` cannot exceed 1 or 255 against a 65536 buffer. |
| 41 | - The disablement secret reaches `dssecretput` only through `dsvalidsecretat` (`gt n 1024` |
| 42 | refuses) and `dsdisable` (`gt n 1024` refuses), matching `om/argon2` `a2tka`, and |
| 43 | `ds_sup`/`ds_dis` are 2048 bytes with a 1024 stride. The two copy sites are bounded at both |
| 44 | ingresses. |
| 45 | |
| 46 | No vulnerability is claimed or retracted by this audit: the values were already bounded, and |
| 47 | the inventory note "absence of migration is not evidence of a bug" still applies to every |
| 48 | module this slice did not touch. |
| 49 | |
| 50 | ## Controls |
| 51 | |
| 52 | `om/store/test/run.py` already pins the reachable caps: `U` (one 65537 chunk refused), `Q` |
| 53 | (exactly 65536 frames, then refuse one more) and `C` (exactly 32 MiB, then refuse one more |
| 54 | byte), each asserting the committed snapshot is byte-identical afterwards. This slice adds the |
| 55 | two charge refusals that are not reachable from the public API: |
| 56 | |
| 57 | - `Y` sets a negative running byte charge in the test image and requires a declared refusal. |
| 58 | - `B` sets a negative running record count and requires a declared refusal. |
| 59 | |
| 60 | Both run on the same image that serves the rest of the suite, and both restore-verify the |
| 61 | committed snapshot. |
| 62 | |
| 63 | Mutants are deliberately not claimed for these two controls. A mutant that drops the checked |
| 64 | step differs from the original only in a state the public API cannot reach, and the difference |
| 65 | it produces there is a trap, which the mutant rule in issue #3 says is not detection. The |
| 66 | reachable-cap controls `U`/`Q`/`C` remain the behavioural pins for the caps themselves. |
| 67 | |
| 68 | ## Reproduction |
| 69 | |
| 70 | ```sh |
| 71 | sh om/store/test/run.sh |
| 72 | sh cmd/tkad/test/run.sh |
| 73 | sh tools/test.sh |
| 74 | ``` |
| 75 | |
| 76 | Verdict at this head: `PASS store` (118 native cases), `PASS tkad` (224 assertions plus the |
| 77 | disk-full, restart, self-exec and corruption arms), `PASS quantity`, `PASS tkasig`, and the |
| 78 | crypto unit suites, from `sh tools/test.sh` (`127` PASS lines, exit 1). The two `FAIL` lines are |
| 79 | `json` and `tka`, and both stop on `go: not found` while building a Go oracle or running the |
| 80 | Go TKA oracle on this host, which has no Go toolchain. This slice touches neither unit, so |
| 81 | those two rows are environmental here and carry no verdict on this change. |
| 82 | |
| 83 | The store suite compiles `om/quantity`, `om/blake2s`, `om/store` and the store pool together, |
| 84 | then runs the driver natively; the daemon suite exercises the same store through the real |
| 85 | socket protocol, including disk-full, restart and corruption cases. |
| 86 | |
| 87 | ## Not claimed |
| 88 | |
| 89 | - `cmd/tkad/state.om`, `cmd/tkad/rpc.om`, `cmd/tkad/helpers.om` and `cmd/tkad/main.om` remain |
| 90 | outside the admitted quantity subgraph. |
| 91 | - No constant-time, secrecy, power-loss or whole-path claim is made here. |
| 92 | - The standing per-slot and temporary-reserve charges for the R5 durable resource frame are not |
| 93 | implemented by this slice; these helpers are the accounting primitives that work starts from. |