feat: audit hardening bundle — M-2/M-3/M-8/M-12–14/M-19 + L-8–10/L-16/L-20/L-21 #25
Labels
No labels
enhancement
governance
QA
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/ust1-window#25
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement the recommended fixes for the following items from
audits/INTERNAL_KIMIK3_1786162831.md, bundled as one delivery track:v_out == 0ust1_out == 0cw20-mintablefork:UpdateMinter(None)must deleteMINTERSmap entrymax(configured, network)).gitignore.env.*; gitleaks allowlist hygiene.expect("poisoned")abort/healthzor fix README that implies HTTP health checksust1-commonproptest/fuzz /u128::MAX-scale edges10^(D-U)mathCurrent codebase
Window dust (M-2 / M-3)
contracts/ust1-window/src/contract.rsdeposit/withdrawcompute outputs viaust1_common::mathand proceed without a zero-output guard.min_vfdusd_out(may be 0); deposit has no min-out (H-1 separate).cw20-mintableremoved zero-amount guards ⇒Mint(0)/Transfer(0)can succeed while user loses principal or burns UST1 for nothing.Minter bookkeeping (M-8)
cw20-mintable@ pinned rev (Cargo.lock).UpdateMinter(None); fork leaves staleMINTERSmetadata.Oracle service hardening (M-12 / M-13 / M-14 / L-9 / L-10 / L-16)
oracle-service/src/bsc.rs: Alloy HTTP provider without explicit timeouts; notokio::time::timeoutaroundrun_once.terra_tx.rs:sequence/account_numberfall back to0viaunwrap_or; fixedDEFAULT_GAS_PRICE0.015uluna/gas.main.rs:liveness.lock().expect("poisoned"); infinite loop, notokio::signalhandler despite feature availability./healthzlistener today.Hygiene & tests (L-8 / M-19 / L-20 / L-21)
.gitignorelists.envonly (not.env.*).terra_tx/evm_rpc/bsclack automated HTTP tests (M-19 / TEST-18); window governance / withdraw stale+rolling edges thin (TEST-6/7/11).ust1-commonhas some proptest; audit asks more differential /u128::MAXedges (L-20).Why this is needed
Constraints / guardrails
/healthzif added: liveness-oriented (process up); do not claim on-chain freshness unless C-3 confirmation is wired — or expose separate ready semantics carefully.min_ust1_out/ fee cap), C-1/C-2/C-3, or H-3 defaults (tracked elsewhere) except shared test helpers.Relevant files
contracts/ust1-window/src/contract.rs,error.rs,multitest.rscw20-mintablefork repo (external) +Cargo.lockpinoracle-service/src/{bsc,terra_tx,main,config,liveness,evm_rpc}.rsoracle-servicetest modules / wiremock fixturessmartcontracts-terraclassic/packages/ust1-common/src/math.rs(+ tests).gitignore, gitleaks config / allowlist if presentREADME.md,docs/DEPLOYMENT.mdRecommended direction
if v_out.is_zero() / ust1_out.is_zero() { return Err(...) }before state mutation / messages; multitest dust cases.run_onceintokio::time::timeout.unwrap_or(0)with errors; parse known account type shapes.max(configured, network).lock().unwrap_or_else(|p| p.into_inner())orparking_lot::Mutex.tokio::select!on SIGTERM/SIGINT vs sleep/tick; finish or abort in-flight tick with log./healthz→ 200 when process is running; update README accurately. If HTTP is rejected product-wise, remove README implication instead — pick one, do not leave the contradiction..env.*; fix gitleaks FPs via allowlist for public docs addresses / generated target paths.vfdusd_decimals >= ust1_decimals(or the exact invariantust1_commonmath assumes).Acceptance criteria
UpdateMinter(addr, None)removes map entry; rev bumped; test in fork or integration..env.*ignored; gitleaks clean on intentional scan path./healthzshipped or docs fixed — no false HTTP health claim.Test plan (all paths)
Contracts
v_out==0,min_out==0) → err; no burn.Fork (M-8)
Oracle service
/healthz→ 200 (if implemented).Common (L-20)
Repo hygiene (L-8)
git check-ignore -v .env.local; gitleaks on docs without FP noise.Test plan (attack / hack / abuse vectors)
/healthzmust not report OK for “on-chain rate fresh” unless truly checked (avoid C-3-class lie); process-up only is OK if documented..env.productionaccidentally added — ignored by git.Verification criteria
cargo test/ clippy / pre-commit green.mentioned in commit
af2f3ddac8mentioned in merge request !41
mentioned in merge request !44
MR verification (issue #25 / !41 + !44)
Verdict: PASS_WITH_NOTES — duplicate MRs !41 and !44 both tip
1ee515a; merging !41 and closing !44 as duplicate.Local tests (tip
1ee515a)cargo test -p ust1-window --lib— 20/20 ✅cargo test -p ust1-common --lib— 22/22 ✅cargo test -p ust1-oracle-service— 30/30 ✅cargo clippy -p ust1-window -p ust1-common -p ust1-oracle-service -- -D warnings— ✅git check-ignore -v .env.local— ✅Problems / gaps before fully closing
cw20-mintablerev bumped to8a50c36but no in-repo test forUpdateMinter(None)deletingMINTERS(AC: "fork or integration").bsc.rshas transport timeouts but no dedicated wiremock/hang test (terra_tx + evm_rpc covered).secret_detectiononly (fullrustjob arrives via !43).mentioned in commit 4cf6e4515892159c5a1b09d956e4fafa9f8f7826
mentioned in commit
4903c83ba3mentioned in commit
9acb26818fMR !41 rebased onto main after !35 (C-3 ConfirmTx) merge and merged. Duplicate MR !44 closed.
mentioned in issue #26
marked as related to #26
mentioned in issue #28
marked as related to #28
mentioned in commit
695e577065mentioned in merge request !45