interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / docs / estimation / reviews / est01_hostile_review.md

76 lines · 8164 bytes Raw Blame History Source

EST-0/EST-1 hostile review (omega-est, 7dbf33e)

Scratch programs: <scratch>/a1.c a2.c a3.c a4.c, mutants in tmp/mut/. Nothing in the repo was edited. Build for all: gcc -std=c11 -O2 -Isrc -Isrc/estimation -ffp-contract=off <prog> src/estimation/*.c src/sha256.c -lm

Counts: BLOCKER 0, MAJOR 3, MINOR 6, NIT 2

MAJOR

M1. est_kf_update trusts the prediction's contents: a forged prediction with a valid prior digest is accepted

File: src/estimation/est_kf.c:167-181 (bind_checks), 190-235 (update). est_check_prediction (est_types.c:167) checks only finiteness/PSD. Nothing verifies the prediction was computed from prior+model: x, P, t_ns, horizon, y_mean, S are free. Evidence (a1.c): forged pred x=42, P=1e-30, t_ns=-77 (before prior t=5000), y_mean=-1e9, S=7, horizon=999: "forged pred update: 0 x=42 P=1e-30 t=-77" (0 = EST_OK; posterior time goes backwards) Also a4.c: horizon=7 with t advanced by 1 step -> update returns 0. Impact: the prior digest / generation "staleness" checks only bind identity, not derivation; an attacker or buggy caller can inject an overconfident state that still carries a valid parent chain and evidence root. Fix: in update/coast, recompute the prediction (est_kf_predict with pred->horizon, same Bu) and require a bit-exact digest match; at minimum check pred->t_ns == prior->t_ns + horizon*step_ns, pred->horizon>=1, and y_mean/S consistency. Add tests for each tampered field.

M2. Known input Bu is not recorded anywhere, so predictions with control input cannot be replayed or verified

File: est_kf.c:117-130; est_types.h est_prediction has no Bu field. Evidence (a4.c): predict with Bu=5 gives x=5, digest differs from Bu=0, but prior/model/horizon fields are identical: "any field records Bu? ... equal: 1". Impact: ADR 0020 section 7 (replayable evidence) and M1's fix are impossible for any prediction with input. The prediction digest also cannot be re-derived from its declared inputs. Fix: add Bu (n doubles + a has_input flag) to est_prediction and its encoding, or refuse Bu in EST-1.

M3. A prediction can be passed off as an observation (ADR 2.1 "prediction != observation")

File: est_types.c:158-166 (est_check_observation only requires non-zero evidence digest); est_kf.c:190. Evidence (a1.c): observation built with z=p.y_mean, R=p.S, evidence = prediction digest, source = zero: "prediction-as-observation update: 0 nis=0 P=50.2493 (P prior 100.001)" (covariance halved from nothing; double counting) Also observation source zero is accepted ("obs zero source check: 0"), so the observation names no producer. Impact: the layer's core anti-conflation rule holds only by C type, not by data. A serialized/decoded observation whose evidence is a model-derived digest is indistinguishable from real evidence. Fix: require non-zero source; add an evidence-kind/domain (e.g. evidence must be an est_digest over a raw-evidence domain that est_* digests can never produce) and in update refuse obs->evidence equal to pdig, digest(prior), prior->evidence_root, or any digest the estimator produced in this call. State the limit (stateless module cannot know all).

MINOR

m1. Covariance PSD/negative-variance tolerance is relative to the LARGEST diagonal, so tiny variances can be negative

File: est_types.c:76-88 (tol = 1e-12*maxd). Evidence (a1.c): diag(1e12,-0.5) -> est_check_covariance returns 0 (accepted). diag(1e12,-100) rejected (-5). Also [[1e6,.5],[.5,0]] (det<0, indefinite) accepted; [[0,1e-170],[1e-170,0]] indefinite accepted (c*c underflows to 0, est_types.c:83-84). Filter-produced covariances did survive: collapse (2e5 steps, Q=0,R=1e-12), scale disparity diag(1e12,1e-6), 1e200 and 1e-200 scales all kept min diag >0 (a2.c). So this is a validator hole, not shown filter breakage. Fix: reject any negative diagonal entry outright (diag < 0), compare c^2 to d*e without underflow (use fabs(c) > sqrt-safe or scaled compare), or scale to unit diagonal before LDL.

m2. Belief/prediction structural invariants are not enforced by est_check_belief

File: est_types.c:150-157. A belief with generation=99, zero parent, zero evidence_root passes (a3.c "forged gen99 ...: 0"), though the header says root is zero only for a declared prior. Fix: require (generation==0) iff parent zero; nonzero model digest.

m3. Model with R=0 is accepted and can permanently wedge update

File: est_check_model; a2.c "R0-P1e-300 step 1 update err -6" (NOT_PD every later update; coast still works). Refusal is loud, not silent. Fix: reject R with zero diagonal in the model, or document.

m4. Unbounded predict horizon (uint32) is a CPU denial of service

est_kf.c:120. a2.c: horizon 1e8 took 0.84s; 4.29e9 is ~35s. Fix: cap horizon (e.g. 1<<20) or use matrix powers.

m5. Asymmetry is accepted (1e-9 relative) and stored/digested as given

Evidence (a1.c): [[1e12,1e3],[0,1]] accepted (asym 1e3 absolute on the small entry scale). Digests then depend on the asymmetry. Fix: canonicalize (symmetrize) in est_kf_prior, or tolerance relative to sqrt(Aii*Ajj).

m6. Test gaps found by mutation (tmp/mut/, each mutant compiled with the real tests)

NIT

Tried and HELD UP