You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(wallet): refuse a spend whose input coin amounts do not sum in a u64
Found while delete-probing the guards: dig-wallet-backend 0.16 accumulates the spent
coins' amounts with an unchecked `+=` (client/verify.rs:153). Those amounts come from an
unsigned skeleton a dapp supplies, so they are attacker-chosen and need not name coins
that exist — an unsummable input total therefore PANICS in a debug build and WRAPS in a
release build, after which the wrapped figure is what value conservation is checked
against. Refusing it here as PolicyIndeterminate makes that unreachable.
Also merge the rolling-cap's two overflow checks into the one that is reachable: the
window's own total could only overflow if two recorded charges summed past u64::MAX,
which the projection check already prevents from ever being recorded, so that half could
never fire and no test could hold it.
Co-Authored-By: Claude <noreply@anthropic.com>
verdict="INCONCLUSIVE (the mutation itself did not compile)"
24
+
else
25
+
verdict="GREEN - VACUOUS"
26
+
fi
27
+
echo"$name :: $verdict"
28
+
cp /tmp/probe.bak "$file"
29
+
}
30
+
31
+
E=src/wallet/enforcer.rs
32
+
S=src/wallet/summary.rs
33
+
A=src/wallet/approval.rs
34
+
35
+
probe "G7 an undeclared intent escalates"$E'self.auto_send.configured_limits(op_class)''self.auto_send.configured_limits(match op_class {
36
+
SpendOpClass::Undeclared => SpendOpClass::Tip,
37
+
declared => declared,
38
+
})'
39
+
40
+
probe "G2 custody total is CHECKED, not saturating"$S'let native_total_mojos = summary.checked_native_total_mojos()?;''let native_total_mojos = summary.native_total_mojos();'
41
+
42
+
probe "G19 input coin amounts must sum in a u64"$S'coin_spends
probe "G13 the rolling projection is checked, not wrapped"$E'.try_fold(total, |sum, record| sum.checked_add(record.mojos))''.try_fold(total, |sum, record| Some(sum.wrapping_add(record.mojos)))'
0 commit comments