From 32c6c7bcec2b0fde4e138c8120fb05d6f00d1515 Mon Sep 17 00:00:00 2001 From: hpmaxi <358059+hpmaxi@users.noreply.github.com> Date: Wed, 11 Nov 2026 15:02:23 -0300 Subject: [PATCH 1/3] docs: map the threat model to STRIDE Place every threat under its STRIDE categories and cover the three the existing threats covered least. Repudiation lists which privileged calls publish an event and what proves an act once the RPC drops it. Information disclosure says what is public on chain and what stays off it. Two threats come out of it: a shared signing link shows its call before it lands (R13), and the verifier stub lists and delists without an event (R14). The scope moves to the commit the events were checked against. Closes #438 --- README.md | 2 +- docs/THREAT_MODEL.md | 274 +++++++++++++++++++++++- docs/strata-product-and-architecture.md | 5 +- 3 files changed, 276 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9e40b0e2..054b37b6 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ than its pending deposits, and once a wind-down is proposed. ledger time, events and calls between contracts. - [Threat model](./docs/THREAT_MODEL.md) — what can go wrong with the oracle, the roles and the redemption paths, what stops it, what is left, and the - test for each control. + test for each control, with each threat placed under STRIDE. - [Monitoring plan](./docs/MONITORING_PLAN.md) — what an operator watches on chain, where each signal comes from, and what to do when it fires. - [Grant differences](./docs/GRANT_DIFFERENCES.md) — where the built kit diff --git a/docs/THREAT_MODEL.md b/docs/THREAT_MODEL.md index e43c5336..9c8b3106 100644 --- a/docs/THREAT_MODEL.md +++ b/docs/THREAT_MODEL.md @@ -2,14 +2,15 @@ What can go wrong in a Strata vault, what stops it, what is left, and the test that shows each control. It covers the oracle, the roles and the redemption -paths. Tranche 3's threat-to-test matrix builds on it. +paths, and places each threat under STRIDE ([STRIDE](#stride)). Tranche 3's +threat-to-test matrix builds on it. ## Scope - **Contracts.** `async-vault`, `share-token` and `nav-oracle`, the testnet stubs `identity-verifier` and `compliance`, and the shared crates `strata-timelock`, `strata-bindings` and `strata-storage`, at commit - `f3c03f8`. + `56b22d1`. - **The console**, as far as signing goes: the `/sign` page that collects an authority's signatures (R12). - **Not the testnet deployment.** The deployment listed in the @@ -836,6 +837,49 @@ An authority opens a shared `/sign` link, sees one operation and signs another. does not propose" and "refuses arguments of the wrong shape" in [`app/src/pages/sign.test.ts`](../app/src/pages/sign.test.ts). +### R13. A signing link read before the call lands + +Whoever holds an authority's `/sign` link can read the call in it before it +lands. + +- **Control:** The console puts the transaction after the link's `#`, which a + browser does not send to the server that hosts the console. The signers pass + the link to each other themselves. The transaction expires seven days after + the console builds it, and the page then refuses to sign it. +- **Residual:** Anyone who sees the link, in a chat or an email, can read the + call until it lands or expires. A holder who learns of a coming freeze can + collect a covered claim, or move wallet shares to another listed account, + before the freeze lands. If a report's link goes round while the epoch it + will price is still open, whoever reads it can join that epoch knowing its + price (O5). Nothing on chain shows who read a link. +- **Tests:** "shows the pending operation in the console's terms" and "signs, + updates the link and submits at the threshold" (the transaction follows + `/sign#`), and "sends an expired link back to the proposer without a share + row", in + [`app/src/pages/SignPage.test.tsx`](../app/src/pages/SignPage.test.tsx). + Who reads a link: none, because nothing can observe it. + +### R14. An allowlist change that publishes no event + +The kit's identity verifier lists or delists an address without publishing an +event. + +- **Control:** None in the verifier: `allow` stores the answer and publishes + nothing. `is_allowed` gives the current answer for any address, and the + signed transaction stays in the network's history + ([Repudiation](#repudiation)). The verifier is a testnet stub; a production + identity registry has its own events. An event for `allow` is planned in + [#441](https://github.com/BootNodeDev/strata-vault-kit/issues/441). +- **Residual:** A watcher that reads events misses every listing and delisting. + A wrong listing (R9) shows only in `is_allowed`, or in the verifier's + transactions: an RPC serves them for about seven days, and after that only a + history archive or a full-history indexer has them. + `set_claim_topics_and_issuers` publishes nothing either, but it stores + nothing. +- **Tests:** none, because the stub publishes no event. The + [monitoring plan](./MONITORING_PLAN.md#what-this-plan-does-not-cover) leaves + the allowlist out for the same reason. + ## Redemption paths ### X1. The reserve cannot pay a priced exit @@ -1256,6 +1300,226 @@ or queued changes. release changes a stored type yet. The failures above are read from the code, and a test belongs with the first release that changes one. +## STRIDE + +STRIDE sorts threats into six kinds: spoofing, tampering, repudiation, +information disclosure, denial of service and elevation of privilege. The +threats above are grouped by area instead. The table places each one under the +kinds it belongs to. The sections after it say what each kind covers here, and +cover in full the three that the threats above cover least: spoofing, +repudiation and information disclosure. + +### Map + +S: spoofing. T: tampering. R: repudiation. I: information disclosure. D: denial +of service. E: elevation of privilege. + +| Threat | S | T | R | I | D | E | +| --- | --- | --- | --- | --- | --- | --- | +| [O1](#o1-one-false-report-within-the-limits) One false report within the limits | | x | | | | | +| [O2](#o2-a-walk-of-reports) A walk of reports | | x | | | | | +| [O3](#o3-a-real-move-larger-than-a-cap) A real move larger than a cap | | x | | | x | | +| [O4](#o4-the-feed-goes-stale) The feed goes stale | | | | | x | | +| [O5](#o5-time-games) Time games | | x | | | | | +| [O6](#o6-declining-a-price-after-seeing-it) Declining a price after seeing it | | | | x | | | +| [O7](#o7-the-nav-pause-used-to-stall-pricing) The NAV pause used to stall pricing | | | | | x | | +| [O8](#o8-clearing-the-stored-report) Clearing the stored report | | x | | | | | +| [O9](#o9-governance-changes-the-limits-or-the-feed) Governance changes the limits or the feed | x | x | | | | | +| [O10](#o10-the-proof-proves-nothing-on-chain) The proof proves nothing on chain | | x | x | | | | +| [O11](#o11-an-oracle-upgraded-in-place-cannot-read-its-old-report) An oracle upgraded in place cannot read its old report | | | | | x | | +| [O12](#o12-an-integrator-reads-a-price-the-vault-would-refuse) An integrator reads a price the vault would refuse | | x | | | | | +| [R1](#r1-governance-compromised-the-changes-that-wait) Governance compromised: the changes that wait | | x | | | | x | +| [R2](#r2-governance-compromised-the-powers-that-act-at-once) Governance compromised: the powers that act at once | | x | | | x | x | +| [R3](#r3-setup-left-open-or-wired-wrong) Setup left open, or wired wrong | | x | | | | x | +| [R4](#r4-an-authoritys-keys) An authority's keys | x | | | | | x | +| [R5](#r5-one-account-in-several-seats) One account in several seats | | | | | | x | +| [R6](#r6-guardian-compromised) Guardian compromised | | | | | x | x | +| [R7](#r7-treasury-compromised) Treasury compromised | | | | | x | x | +| [R8](#r8-the-manager-stops-sealing-or-picks-the-moment) The manager stops sealing, or picks the moment | | x | | | x | | +| [R9](#r9-compliance-compromised) Compliance compromised | x | | | | x | x | +| [R10](#r10-compliance-and-governance-move-a-holders-shares-together) Compliance and governance move a holder's shares together | | x | | | | x | +| [R11](#r11-swapping-the-tokens-compliance-contract-or-verifier) Swapping the token's compliance contract or verifier | x | x | | | x | | +| [R12](#r12-a-crafted-transaction-on-the-consoles-signing-page) A crafted transaction on the console's signing page | x | x | | | | | +| [R13](#r13-a-signing-link-read-before-the-call-lands) A signing link read before the call lands | | | | x | | | +| [R14](#r14-an-allowlist-change-that-publishes-no-event) An allowlist change that publishes no event | | | x | | | | +| [X1](#x1-the-reserve-cannot-pay-a-priced-exit) The reserve cannot pay a priced exit | | | | | x | | +| [X2](#x2-a-pause-a-stale-feed-or-a-delisting-blocks-a-covered-claim) A pause, a stale feed or a delisting blocks a covered claim | | | | | x | | +| [X3](#x3-a-frozen-holder) A frozen holder | | x | | | x | | +| [X4](#x4-a-delisted-holder) A delisted holder | x | | | | x | | +| [X5](#x5-escrowed-shares-that-should-come-back) Escrowed shares that should come back | | | | | x | | +| [X6](#x6-a-compliance-module-blocks-exits) A compliance module blocks exits | | | | | x | | +| [X7](#x7-escrow-behind-stalled-pricing) Escrow behind stalled pricing | | | | | x | | +| [X8](#x8-wind-down) Wind-down | | x | | | x | | +| [X9](#x9-rounding-and-amounts-below-one-share) Rounding and amounts below one share | | x | | | | | +| [X10](#x10-the-deposit-assets-issuer-freezes-or-claws-back-the-vaults-cash) The deposit asset's issuer freezes or claws back the vault's cash | | x | | | x | | +| [X11](#x11-storage-that-expires) Storage that expires | | | | | x | | +| [X12](#x12-resource-limits-contention-and-griefing) Resource limits, contention and griefing | | | | | x | | +| [X13](#x13-an-upgrade-cannot-read-what-the-vault-stored) An upgrade cannot read what the vault stored | | | | | x | | + +### Spoofing + +Acting as another account, contract or person. What proves who is calling: + +- **Holders.** Each request, cancellation and claim names a holder, and the + vault asks that holder to sign (`holder.require_auth()`). The vault has no + operators, so no one else can act for a holder. The calls anyone may make + check no role: pricing a sealed epoch, funding the vault, activating a + wind-down that is due, finalizing a round, and sealing an epoch that has run + the minimum epoch duration. They act on ledger time and stored state, and + `fund` asks only the payer to sign. +- **Authorities.** Each privileged call checks that the account holds the role, + or is the admin, and asks that account for one signature + ([authorization matrix](./AUTHORIZATION_MATRIX.md)). The Soroban host checks + the signature against the account's signers and thresholds; the kit takes + that check on trust ([Assumptions](#assumptions)). No contract can check that + an authority is a multisig, or how many keys it needs (R4). +- **Contracts.** The share token accepts a mint, a burn or a forced transfer + only from its `manager`, the vault. The host accepts a contract's + authorization only when that contract makes the call, so no account can pose + as the vault. The other way round, the vault and the token believe whatever + answers at the oracle, compliance and verifier addresses governance set. + After setup, changing those waits for the timelock (O9, R11), and + `finish_setup` checks that each one answers what it should (R3). +- **Investors.** The allowlist says who may hold shares. A compliance key that + lists an address it should not (R9), a verifier that lets anyone in (R11), or + an unlisted address that gets in (X4) lets someone pose as a verified + investor. +- **The console.** The `/sign` page decodes a transaction and shows it in the + console's terms before anyone signs, and refuses one it cannot show (R12). A + copy of the console hosted by someone else can show anything; each operator + hosts its own. + +R4 and R12 hold the tests: one signature per account for each privileged call, +and the signing page's refusals. + +### Tampering + +Changing the price, the books, the code, or a transaction before it is signed: + +- the price: O1, O2, O3, O5, O8, O9, O10, O12; +- code, roles and wiring: R1, R2, R3, R11; +- what a holder is owed or paid: R10, X3, X8, X9, X10; +- when an epoch is sealed: R8; +- the transaction a signer approves: R12. + +### Repudiation + +Denying an act, or an act no one can trace. What the chain records: + +- **Events.** Every privileged call that changes state publishes an event, + except the verifier's `allow` (R14). That covers the setup setters and + `finish_setup`; the change queue (`ChangeProposed`, `ChangeApplied`, + `ChangeCancelled`; an upgrade's `ChangeApplied` carries the new code's hash); + role grants, revocations and admin hand-overs; the vault's, the token's and + the NAV's pauses; reports, `clear_latest` and `set_config`; sealing an epoch + and deploying to the custodian; the wind-down; freezes, legal transfers and + recoveries; and the compliance contract's modules and bindings. Holders' + requests, cancellations and claims publish events too, and so do the calls + anyone may make. Three calls succeed without an event because they change + nothing: granting a role already held, a recovery from an empty balance, and + the verifier's `set_claim_topics_and_issuers`. A refused call publishes + nothing, because its transaction rolls back. +- **Who signed.** An event says what happened, not whose keys approved it. The + transaction does: it carries a signature from each account the call needs + (R4) and, for a multisig, shows which of its keys signed. A legal transfer + or a recovery carries both compliance's and governance's signatures (R10). + A report carries a proof hash that ties the attester to its evidence (O10). +- **After the RPC drops them.** An RPC serves events and transactions for about + seven days by default + ([monitoring plan](./MONITORING_PLAN.md#how-events-are-read-and-kept)). After + that, three things still prove an act: + - the network's history archives, which keep every transaction with its + signatures and its result. Reading one back takes the archive files or an + indexer that keeps full history, not an RPC; + - the state the act left, which the getters show: role holders, freezes, + queued changes, the stored report. It shows the outcome, not who caused it + or when; + - the records a watcher keeps as it reads each event. The monitoring plan + lists the [events it reads](./MONITORING_PLAN.md#events-the-plan-reads). +- **Residual:** The kit runs no watcher, so history past the RPC's window + depends on one the operator runs, or on the archives. A change to an + authority's signers or thresholds is a Stellar account operation, not a + contract event; the monitoring plan leaves it to an account-history service + (R4). The verifier stub's listings publish no event (R14). +- **Tests:** `a_refused_call_publishes_nothing` in + [`events.rs`](../contracts/async-vault/src/test/events.rs); + `finishing_setup_publishes_it` in + [`setup.rs`](../contracts/async-vault/src/test/setup.rs); + `applying_a_custodian_change_publishes_both_events` in + [`governance.rs`](../contracts/async-vault/src/test/governance.rs); + `proposing_and_applying_publish_the_change` and + `cancelling_publishes_the_change_id` in + [`upgrade.rs`](../contracts/async-vault/src/test/upgrade.rs), and + `proposing_and_applying_publish_the_change` in + [`share-token/src/test_governance.rs`](../contracts/share-token/src/test_governance.rs), + [`nav-oracle/src/test/governance.rs`](../contracts/nav-oracle/src/test/governance.rs) + and + [`compliance/src/test/changes.rs`](../contracts/compliance/src/test/changes.rs); + `attesting_publishes_the_stored_valuation` in + [`nav-oracle/src/test/oracle.rs`](../contracts/nav-oracle/src/test/oracle.rs); + `a_zero_share_legal_transfer_passes_and_is_published` in + [`share-token/src/test.rs`](../contracts/share-token/src/test.rs). The + pause, role, hand-over, freeze and recovery events come from OpenZeppelin's + libraries ([Assumptions](#assumptions)). The kit's own `LatestCleared`, + `NavPausedSet`, `Deployed`, `DepositCapUpdated`, `NoticeSet`, + `WindDownDelaySet` and `VaultBound`, and the wind-down's events: none yet. + +### Information disclosure + +Revealing what should stay private, or revealing it too early. Everything a +contract stores or publishes can be read by anyone, now and later. That is the +design: anyone can check the books without trusting the operator. On chain: + +- each holder's shares and frozen shares, requests per epoch, what is owed to + them, and wind-down credits; +- each address's allowlist entry; the kit's verifier stores only whether the + address is listed; +- each report: the price, its times, the proof hash and, when the attester + gives one, the proof URI; +- the role holders, the queued changes, and every event with its addresses and + amounts. + +Off chain: the KYC data behind each allowlist entry, and the valuation's inputs +behind each report. The kit's verifier keeps only a yes or no per address, and +the oracle only a hash and an optional URI per report. What an external +identity registry keeps on chain is its own choice. The quality of the KYC and +of the valuation is out of scope ([Out of scope](#out-of-scope)); this section +says only where the data stays. + +- **Residual:** An address is not a name, but anyone who links one to a person + sees that person's position and its history. A listed address shows that its + owner passed the operator's KYC. A holder who needs more privacy than a + public ledger gives cannot get it from the kit. What the proof URI points to + is public as well; an attester that wants the evidence kept private publishes + the hash alone and shows the evidence to whoever checks it. + +Two threats are about learning something too early: O6, a sealed epoch's price +read while its holders can still cancel, and R13, a signing link read before +its call lands. + +### Denial of service + +Stopping pricing, exits or calls: + +- pricing stops: O3, O4, O7, O11; +- an authority stalls the vault, holds back a holder or leaves the reserve + short: R2, R6, R7, R8, R9, R11; +- exits are held: X1 to X8, X10; +- calls fail: X11, X12, X13. + +### Elevation of privilege + +Gaining a power one should not hold, or using one beyond its purpose: + +- an authority's keys are taken: R1, R2, R6, R7, R9; +- setup is left open: R3; +- one key acts alone, or a call takes more signatures than it shows: R4; +- one account holds several seats: R5; +- two authorities act together: R10. + +No threat covers a holder gaining a role: every privileged call checks the role +and asks its holder to sign (R4). + ## Known limits These are decided, and stated as they stand: @@ -1267,7 +1531,7 @@ These are decided, and stated as they stand: the minimum epoch duration, then anyone seals; with none set, holders wait until governance replaces the manager (R8). 3. The identity verifier and compliance contracts in this repository are - testnet stubs, not for mainnet (R9, R11). + testnet stubs, not for mainnet (R9, R11, R14). 4. The vault's constructor is the only check on who holds which role, for four pairs; later grants and the other contracts' roles are not checked (R5). The share token does refuse a legal transfer or recovery signed by one account @@ -1303,6 +1567,10 @@ For Tranche 3's matrix: earlier shape (X13). - Alerts on large price moves, on `LatestCleared` and on the report after it (O2, O8), which belong to the [monitoring plan](./MONITORING_PLAN.md). +- The events of the kit's own `LatestCleared`, `NavPausedSet`, `Deployed`, + `DepositCapUpdated`, `NoticeSet`, `WindDownDelaySet` and `VaultBound`, and + of the wind-down ([Repudiation](#repudiation)). +- An allowlist change, which publishes no event to test (R14). ## Out of scope diff --git a/docs/strata-product-and-architecture.md b/docs/strata-product-and-architecture.md index 31b85b01..b82225dd 100644 --- a/docs/strata-product-and-architecture.md +++ b/docs/strata-product-and-architecture.md @@ -674,7 +674,10 @@ public surface given the vault address. | Wind-down distribution | Unfinalized rounds stall distribution | Finalizing a round is permissionless: once treasury returns capital, anyone can finalize the round to credit holders; the operator cannot stall payouts after funding | The full threat model, with the test for each control, is in -[`docs/THREAT_MODEL.md`](./THREAT_MODEL.md). +[`docs/THREAT_MODEL.md`](./THREAT_MODEL.md). It follows STRIDE: a table places +each threat under one or more of spoofing, tampering, repudiation, information +disclosure, denial of service and elevation of privilege, and every category +has at least one threat. The monitoring plan, with what an operator watches on chain and the response to each signal, is in [`docs/MONITORING_PLAN.md`](./MONITORING_PLAN.md). From 8d27725c5a0f22d8d2c0b8abda64172224f77e17 Mon Sep 17 00:00:00 2001 From: hpmaxi <358059+hpmaxi@users.noreply.github.com> Date: Thu, 12 Nov 2026 12:58:55 -0300 Subject: [PATCH 2/3] docs: add the STRIDE threat model in Stellar's template Present the threat model in the shape the Audit Bank asks for: a data flow diagram with its trust boundaries, numbered flows, issues for each STRIDE category with their remediations, the Soroban checks and the points the repository cannot confirm. Each issue points to the threat that holds its control and tests instead of restating it. Two risks had no threat of their own and get one: a call made in a holder's name (X14) and the choice of which report prices an epoch (O13). --- README.md | 3 + docs/STRIDE-threat-model.md | 352 ++++++++++++++++++++++++++++++++++++ docs/THREAT_MODEL.md | 62 ++++++- 3 files changed, 412 insertions(+), 5 deletions(-) create mode 100644 docs/STRIDE-threat-model.md diff --git a/README.md b/README.md index 054b37b6..832ff71a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ than its pending deposits, and once a wind-down is proposed. - [Threat model](./docs/THREAT_MODEL.md) — what can go wrong with the oracle, the roles and the redemption paths, what stops it, what is left, and the test for each control, with each threat placed under STRIDE. +- [STRIDE threat model](./docs/STRIDE-threat-model.md) — the threat model in + the format of Stellar's STRIDE template: a data flow diagram, numbered flows, + issues for each category and their remediations. - [Monitoring plan](./docs/MONITORING_PLAN.md) — what an operator watches on chain, where each signal comes from, and what to do when it fires. - [Grant differences](./docs/GRANT_DIFFERENCES.md) — where the built kit diff --git a/docs/STRIDE-threat-model.md b/docs/STRIDE-threat-model.md new file mode 100644 index 00000000..60aaf9e6 --- /dev/null +++ b/docs/STRIDE-threat-model.md @@ -0,0 +1,352 @@ +# STRIDE threat model + +Strata's threat model in the format of Stellar's +[STRIDE template](https://developers.stellar.org/docs/build/security-docs/threat-modeling/STRIDE-template). +Each issue below points to the threat in [`THREAT_MODEL.md`](./THREAT_MODEL.md) +that holds its full control, residual risk and tests, instead of restating +them. Three issues are about what the whole ledger records or shows rather than +one control; they point to the threat model's Repudiation and Information +disclosure sections. The results of the automated security scan are in +[`SECURITY_SCAN.md`](./SECURITY_SCAN.md). + +It covers the code at commit `56b22d1`, whose code is the same as the +`tranche2` tag. + +## What are we working on? + +Strata is an open-source vault kit on Stellar for real-world assets. Investors +deposit a stablecoin, such as USDC, and receive vault shares. The money is +invested off chain through a custodian, so there is no market price on chain: +an attester posts the value of one share (the NAV) to an oracle. Deposits and +redemptions are requests. They wait in escrow until the open epoch is sealed and +then priced with a report accepted after the seal. Then each holder claims their +shares or their cash. + +On chain, the kit has five contracts: + +- **Vault** (`async-vault`): requests, epochs, pricing, the cash reserve, + claims, the timelock for admin changes, and the wind-down. +- **Share token** (`share-token`): an OpenZeppelin RWA token. Mints and + transfers between holders are checked against the identity verifier and the + compliance contract. The vault's escrow moves (`forced_transfer`) skip those + checks; the vault checks the holder itself. +- **NAV oracle** (`nav-oracle`): stores the latest report and refuses one + outside the price band, beyond the maximum move, inside the cooldown or + already expired. +- **Identity verifier** and **compliance** (`identity-verifier`, `compliance`): + decide which accounts may hold and move shares. Both are testnet stubs. + +Off chain, the kit ships one static web app with no backend. Its investor dApp +offers the investor's requests, cancellations and claims, the wind-down claim +included. Its admin console offers the privileged calls and the `/sign` page +where an authority's signers collect signatures. Both read the contracts through +a Stellar RPC. The authorities (governance, guardian, treasury, attester, +compliance) are meant to be Stellar multisig accounts; the manager is a role. +The custodian, the valuation behind each report, the KYC behind the allowlist +and any watcher are the operator's. A keeper is any account that makes the calls +anyone may make, such as pricing an epoch. + +### Data flow diagram + +Each box with a title is a trust boundary. Every arrow carries the step numbers +of the flows below and the call it makes. Transactions and reads go through a +Stellar RPC; the diagram draws them from the caller to the contract. + +```mermaid +flowchart LR + subgraph TB1["Investor's browser and wallet"] + INV["Investor's wallet"] + DAPP["Investor dApp"] + end + subgraph TB2["Operator's devices"] + AUTH["Authorities' accounts
governance, guardian, treasury,
compliance, manager"] + ATT["Attester's account"] + CON["Admin console
and /sign page"] + end + subgraph TB3["Operator's off-chain records"] + VAL[("Valuation and
its evidence")] + KYC[("KYC records")] + WATCH["Watcher"] + end + subgraph TB4["Third parties"] + CUST["Custodian"] + KEEP["Keeper: any account"] + end + subgraph NET["Stellar network"] + LOG[("RPC event window,
about 7 days")] + HIST[("History archives")] + subgraph KIT["Strata contracts"] + V["Vault"] + T["Share token"] + O["NAV oracle"] + IV["Identity verifier"] + C["Compliance"] + end + subgraph EXT["Outside the kit"] + A["Deposit asset (SAC)"] + end + end + + INV -->|"1.1, 2.1, 6.1, 11.1, 13.4 sign"| DAPP + DAPP -->|"1.2 request_deposit
2.2 request_redeem
6.2 claim_deposit, claim_redeem
11.2 cancel_deposit, cancel_redeem
13.4 claim_wind_down"| V + V -->|"1.3, 2.3 verify_identity"| IV + V -->|"1.4 state
5.2 state, attested_at, nav_per_share"| O + V -->|"1.5 transfer in
6.3, 11.4, 13.4 transfer out
8.2 transfer to the custodian
8.3 transfer from the payer"| A + V -->|"1.3, 2.3 identity_verifier, is_frozen
2.3 get_frozen_tokens
2.4, 11.4 forced_transfer
6.3 mint, burn
13.4 burn"| T + T -->|"6.4, 12.2 verify_identity"| IV + T -->|"2.4, 11.4 transferred
6.3, 13.4 destroyed
6.4 can_create, created
12.2 can_transfer"| C + KEEP -->|"3.1 close_epoch
5.1 fulfill_epoch
8.3 fund
13.2 activate_wind_down
13.3 finalize_wind_down_round"| V + CUST -->|"4.1 holdings"| VAL + VAL -->|"4.2 price, proof hash, proof URI"| ATT + KYC -->|"9.1 who passed KYC"| AUTH + ATT -->|"4.3 sign"| CON + AUTH -->|"3.1, 7.1, 7.3, 8.1, 9.2, 9.3, 13.1 sign"| CON + AUTH -->|"12.1 legal_transfer,
built outside the console"| T + CON -->|"3.1 close_epoch
5.1 fulfill_epoch
7.1 propose_change
7.3 apply_change
8.1 deploy_to_custodian
8.3 fund
13.1 propose_wind_down"| V + CON -->|"4.3 attest"| O + CON -->|"9.2 allow"| IV + CON -->|"9.3 set_address_frozen,
freeze_partial_tokens"| T + KIT -->|"10.1 events"| LOG + KIT -->|"10.1 signed transactions
and their results"| HIST + WATCH -->|"10.2 getEvents"| LOG + WATCH -->|"10.2 getters"| KIT +``` + +What crossing each boundary means: + +- **Investor's browser and wallet.** Anything the dApp builds is checked by the + contracts; the dApp holds no key and no secret. The investor's signature + proves the holder (X14). +- **Operator's devices.** The console builds privileged calls and the `/sign` + page shows them before a signer approves (R12, R13). Each authority's + signature proves the role holder (R4). +- **Operator's off-chain records.** The valuation, its evidence and the KYC + records never reach the chain. Only a proof hash, an optional proof URI and a + yes or no per address do (O10, R9). +- **Third parties.** The custodian and any keeper are outside the operator's + control. A keeper can only make the calls anyone may make. The custodian + holds the deployed capital off chain. +- **Strata contracts.** The contracts check every call themselves. They trust + the host's signature checks and the contracts at the addresses governance set + (the oracle, the verifier, the compliance contract). +- **Outside the kit.** The deposit asset's issuer can freeze or claw back the + vault's cash (X10). + +### Data entities + +| Entity | Where | Who writes it | +| --- | --- | --- | +| Deposit and redemption requests, epochs, positions, wind-down credits, running totals | Vault storage | Holders' and anyone's calls; pricing | +| Queued admin changes and their ETAs | Vault, share token, oracle and compliance storage | Governance | +| Share balances and frozen shares | Share token storage | The vault (mint, burn, forced transfer); compliance (freezes, and legal transfers with governance) | +| The latest report: price, times, proof hash and URI | Oracle storage | The attester | +| Allowlist entries: yes or no per address | Identity verifier storage | Compliance | +| Compliance modules and bound tokens | Compliance storage | Governance | +| The deposit asset's balances | The asset's contract (SAC) | Transfers; the issuer | +| Events | An RPC's window, about seven days | Each contract | +| Signed transactions and their results | The network's history archives | The network | +| Valuation evidence, KYC records | Operator, off chain | Attester, compliance | + +### Flows + +Each step is numbered so a threat can cite it. + +1. **Deposit request.** + 1. The investor signs `request_deposit(holder, amount)` in their wallet. + 2. The dApp sends it to the vault. + 3. The vault reads the token's verifier (`identity_verifier`) and checks the + holder with it (`verify_identity`). + 4. The vault checks that the oracle answers `Valid` (`state`). + 5. The vault moves `amount` of the deposit asset from the holder into escrow + (`transfer`) and publishes `DepositRequested`. +2. **Redemption request.** + 1. The investor signs `request_redeem(holder, shares)`. + 2. The dApp sends it to the vault. + 3. The vault checks the holder's standing (`verify_identity`, `is_frozen`) + and their frozen shares (`get_frozen_tokens`). + 4. The vault moves the shares into its escrow (`forced_transfer`), which the + token reports to the compliance contract (`transferred`), and publishes + `RedeemRequested`. +3. **Epoch close.** + 1. The manager, or anyone once the open epoch has run the minimum epoch + duration, calls `close_epoch(caller)`. The vault seals the epoch, opens + the next and publishes `EpochClosed`. The notice starts. +4. **Attest.** + 1. The custodian reports the fund's holdings to the attester, off chain. + 2. The attester values the fund, keeps the evidence and hashes it. + 3. The attester's account signs `attest(input, caller)` through the console. + 4. The oracle checks the band, the maximum move, the cooldown and the expiry, + stamps the time it accepted the report and publishes `NavAttested`. +5. **Fulfil.** + 1. Once the notice ends, anyone calls `fulfill_epoch(epoch_id)`. + 2. The vault reads the oracle (`state`, `attested_at`, `nav_per_share`) and + refuses a report accepted before the seal. + 3. The vault fixes the shares and the cash each side is owed, and publishes + `EpochFulfilled`. +6. **Claim.** + 1. The investor signs `claim_deposit` or `claim_redeem`. + 2. The dApp sends it to the vault. + 3. For a deposit, the vault mints the shares to the holder (`mint`). For a + redemption, it pays the cash (`transfer`) and burns the escrowed shares + (`burn`), which the token reports to the compliance contract + (`destroyed`). + 4. On a mint, the share token checks the holder with the identity verifier + and the compliance contract (`verify_identity`, `can_create`), then + reports the mint (`created`). +7. **Timelocked admin change.** + 1. Governance's signers sign `propose_change(change)` through the console's + `/sign` page. + 2. The vault queues the change with its ETA and publishes `ChangeProposed`. + 3. After the delay, governance signs `apply_change(id)`. The vault checks the + change again, applies it and publishes `ChangeApplied`. A code change + replaces the contract's code with `update_current_contract_wasm`. +8. **Capital to and from the custodian.** + 1. The treasury calls `deploy_to_custodian(caller, assets)`. + 2. The vault sends free reserve to the custodian (`transfer`) and publishes + `Deployed`. + 3. Cash comes back through `fund(caller, assets)`, which anyone may call; the + vault takes it from the payer (`transfer`) and publishes `Funded`. +9. **Allowlist and freeze.** + 1. Compliance checks an investor's KYC, off chain. + 2. Compliance signs `allow(account, allowed)` on the identity verifier. + 3. Compliance freezes or unfreezes an address or part of its shares on the + share token (`set_address_frozen`, `freeze_partial_tokens`). +10. **Monitoring.** + 1. Each contract publishes events, which an RPC serves for about seven + days; the network keeps every signed transaction and its result. + 2. A watcher reads the events (`getEvents`) and the contracts' getters, and + stores them. +11. **Cancellation.** + 1. The investor signs `cancel_deposit` or `cancel_redeem`. + 2. The dApp sends it to the vault. + 3. The vault checks that the request can still be cancelled: its epoch is + open, or sealed but no longer priceable, or a wind-down is active. + 4. The vault returns the escrowed cash (`transfer`) or shares + (`forced_transfer`, reported to the compliance contract as + `transferred`), and publishes `DepositCancelled` or `RedeemCancelled`. +12. **Legal transfer.** + 1. Compliance and governance sign one `legal_transfer` call, built outside + the console. + 2. The share token checks that the two signers are different accounts, that + neither side is the vault and that the destination passes the identity + check (`verify_identity`, `can_transfer`), moves the shares and + publishes `LegalTransfer`. +13. **Wind-down.** + 1. Governance signs `propose_wind_down` through the console; it waits its + own delay, 7 to 90 days. + 2. Once it is due, anyone calls `activate_wind_down`. + 3. The treasury returns capital (`fund`), and anyone calls + `finalize_wind_down_round` to credit holders. + 4. Each holder signs `claim_wind_down`; the vault burns the shares the + holder gives up (`burn`, reported as `destroyed`) and pays the cash + (`transfer`). + +## What can go wrong? + +### STRIDE reminders + +| Mnemonic Threat | Definition | Question | +| --- | --- | --- | +| **S**poofing | The ability to impersonate another user or system component to gain unauthorized access. | Is the user who they say they are? | +| **T**ampering | Unauthorized alteration of data or code. | Has the data or code been modified in some way? | +| **R**epudiation | The ability for a system or user to deny having taken a certain action. | Is there enough data to “prove” the user took the action if they were to deny it? | +| **I**nformation Disclosure | The over-sharing of data expected to be kept private. | Is there anywhere where excessive data is being shared or controls are not properly in place to protect private information? | +| **D**enial of Service | The ability for an attacker to negatively affect the availability of a system. | Can someone, without authorization, impact the availability of the service or business? | +| **E**levation of Privilege | The ability for an attacker to gain additional privileges and roles beyond what they initially were granted. | Are there ways for a user, without proper authentication (verifying identity) and authorization (verifying permission) to gain access to additional privileges, either through standard (normally legitimate) or illegitimate means? | + +### Threat table + +Each issue names the attacker (or says that none is needed), the step it +targets and what it breaks, then the threat in `THREAT_MODEL.md` that treats it. + +| Threat | Issues | +| --- | --- | +| **S**poofing | **Spoof.1** - Someone with enough of an authority's keys to reach its threshold signs as that authority (steps 3.1, 4.3, 7.1, 8.1, 9.2, 13.1) and gets every power it holds. [R4](./THREAT_MODEL.md#r4-an-authoritys-keys)
**Spoof.2** - Someone who hosts a copy of the console, or crafts a `/sign` link, shows an authority one call and gets it to sign another (steps 4.3, 7.1, 9.2). [R12](./THREAT_MODEL.md#r12-a-crafted-transaction-on-the-consoles-signing-page)
**Spoof.3** - A compliance key lists an address that never passed KYC, or governance swaps in a verifier that answers yes for anyone (steps 9.2, 1.3, 6.4), so an unverified account holds shares. [R9](./THREAT_MODEL.md#r9-compliance-compromised), [R11](./THREAT_MODEL.md#r11-swapping-the-tokens-compliance-contract-or-verifier), [X4](./THREAT_MODEL.md#x4-a-delisted-holder)
**Spoof.4** - Governance swaps in an oracle it controls (step 7.3), and the vault prices epochs from it as if it were the real feed (step 5.2). [O9](./THREAT_MODEL.md#o9-governance-changes-the-limits-or-the-feed)
**Spoof.5** - Any account requests, cancels or claims in a holder's name (steps 1.2, 2.2, 6.2, 11.2, 13.4) to move the holder's escrow or take their payout. [X14](./THREAT_MODEL.md#x14-a-call-made-in-a-holders-name) | +| **T**ampering | **Tamper.1** - A compromised or careless attester posts a false price inside the limits, or walks the price in steps (step 4.3), and every request priced from it gets the wrong price. [O1](./THREAT_MODEL.md#o1-one-false-report-within-the-limits), [O2](./THREAT_MODEL.md#o2-a-walk-of-reports)
**Tamper.2** - The attester posts a report whose evidence is missing or does not support the price (steps 4.2, 4.3). [O10](./THREAT_MODEL.md#o10-the-proof-proves-nothing-on-chain)
**Tamper.3** - The attester gives a report a far expiry or a valuation made before the seal, or a holder acting as keeper waits to fulfil until a report suits them (steps 4.3, 5.1), to favour some holders over others. [O5](./THREAT_MODEL.md#o5-time-games), [O13](./THREAT_MODEL.md#o13-choosing-which-report-prices-an-epoch)
**Tamper.4** - Someone with governance's keys changes code, roles or wiring (steps 7.1 to 7.3). [R1](./THREAT_MODEL.md#r1-governance-compromised-the-changes-that-wait), [R11](./THREAT_MODEL.md#r11-swapping-the-tokens-compliance-contract-or-verifier)
**Tamper.5** - A holder uses rounding to take more than their share (steps 1.5, 5.3, 6.3). [X9](./THREAT_MODEL.md#x9-rounding-and-amounts-below-one-share)
**Tamper.6** - Compliance and governance together move a holder's wallet shares (step 12.1). [R10](./THREAT_MODEL.md#r10-compliance-and-governance-move-a-holders-shares-together) | +| **R**epudiation | **Repudiate.1** - Compliance lists or delists an address and later denies it; the verifier stub publishes no event (step 9.2). [R14](./THREAT_MODEL.md#r14-an-allowlist-change-that-publishes-no-event)
**Repudiate.2** - The attester denies what a report was based on (steps 4.2, 4.3). [O10](./THREAT_MODEL.md#o10-the-proof-proves-nothing-on-chain)
**Repudiate.3** - An authority denies a privileged act once the RPC has dropped its events, about seven days later (step 10.1). [Repudiation](./THREAT_MODEL.md#repudiation)
**Repudiate.4** - An authority changes its own signers or thresholds and later denies it. This is an operation on its Stellar account, outside the flows, and publishes no contract event. [Repudiation](./THREAT_MODEL.md#repudiation) | +| **I**nformation Disclosure | **Info.1** - Anyone who links an address to a person reads that person's position, requests and history, and sees that they passed KYC (contract storage and events, step 10.1). [Information disclosure](./THREAT_MODEL.md#information-disclosure)
**Info.2** - Someone who sees a `/sign` link reads a freeze or a price before it lands (steps 4.3, 9.3), so a holder collects or moves value first. [R13](./THREAT_MODEL.md#r13-a-signing-link-read-before-the-call-lands)
**Info.3** - A holder reads a sealed epoch's price and cancels if it does not suit them (steps 5.2, 11.3). [O6](./THREAT_MODEL.md#o6-declining-a-price-after-seeing-it)
**Info.4** - Anyone who reads a report fetches the evidence at its proof URI, which the operator meant to keep private (step 4.3). [Information disclosure](./THREAT_MODEL.md#information-disclosure) | +| **D**enial of Service | **DoS.1** - The attester stops reporting, or a compromised guardian pauses the NAV or the vault again and again (steps 4.3, 5.2), so no epoch is priced. [O4](./THREAT_MODEL.md#o4-the-feed-goes-stale), [O7](./THREAT_MODEL.md#o7-the-nav-pause-used-to-stall-pricing), [R6](./THREAT_MODEL.md#r6-guardian-compromised)
**DoS.2** - A loss at the custodian leaves priced exits owing more cash than the vault holds, or the deposit asset's issuer freezes or claws back the vault's cash (steps 6.3, 13.4), so claims wait. [X1](./THREAT_MODEL.md#x1-the-reserve-cannot-pay-a-priced-exit), [X10](./THREAT_MODEL.md#x10-the-deposit-assets-issuer-freezes-or-claws-back-the-vaults-cash)
**DoS.3** - A compliance module refuses or fails, or governance installs one that does, so escrow moves, mints and burns fail (steps 2.4, 6.3, 6.4, 11.4). [X6](./THREAT_MODEL.md#x6-a-compliance-module-blocks-exits)
**DoS.4** - The manager stops sealing (step 3.1), so requests wait. [R8](./THREAT_MODEL.md#r8-the-manager-stops-sealing-or-picks-the-moment)
**DoS.5** - No attacker is needed: a deposit worth less than one share whose refund can only come from the epoch's own rounding dust, or a zero-asset redemption whose holder is delisted before claiming, stays stuck because its epoch never reconciles (steps 6.2, 6.3). [X4](./THREAT_MODEL.md#x4-a-delisted-holder), [#434](https://github.com/BootNodeDev/strata-vault-kit/issues/434), [#445](https://github.com/BootNodeDev/strata-vault-kit/issues/445)
**DoS.6** - No attacker is needed: when a report expires inside its cooldown, the attester cannot post a fresh one until the cooldown ends (step 4.4), so pricing waits. [O4](./THREAT_MODEL.md#o4-the-feed-goes-stale), [#435](https://github.com/BootNodeDev/strata-vault-kit/issues/435)
**DoS.7** - An idle contract's storage archives, anyone files many requests to push calls past a transaction's limits, or an upgrade cannot read what the old code stored (any step), so calls fail. [X11](./THREAT_MODEL.md#x11-storage-that-expires), [X12](./THREAT_MODEL.md#x12-resource-limits-contention-and-griefing), [X13](./THREAT_MODEL.md#x13-an-upgrade-cannot-read-what-the-vault-stored) | +| **E**levation of Privilege | **Elevation.1** - Someone with governance's keys upgrades a contract, grants roles or swaps the oracle, verifier or rules (steps 7.1 to 7.3), or uses the powers that act at once. [R1](./THREAT_MODEL.md#r1-governance-compromised-the-changes-that-wait), [R2](./THREAT_MODEL.md#r2-governance-compromised-the-powers-that-act-at-once)
**Elevation.2** - A deployer opens deposits while admin changes are still instant, or with a binding missing (before step 1.2). [R3](./THREAT_MODEL.md#r3-setup-left-open-or-wired-wrong)
**Elevation.3** - Someone who takes one key that holds several roles reaches several powers (grants at step 7.3). [R5](./THREAT_MODEL.md#r5-one-account-in-several-seats)
**Elevation.4** - Someone with a guardian or treasury key tries to reach past its role: moving funds, or draining the reserve (step 8.1). [R6](./THREAT_MODEL.md#r6-guardian-compromised), [R7](./THREAT_MODEL.md#r7-treasury-compromised) | + +## What are we going to do about it? + +Each remediation is **In place** (with the code or test that shows it), +**Recommended** (not built or not run yet), or **Accepted** (with the reason and +the risk that remains). The threat each issue points to lists every test. + +| Threat | Issues | +| --- | --- | +| **S**poofing | **Spoof.1.R.1** - In place: each privileged call checks the role, asks that account for exactly one signature, and the network checks it against the account's signers and thresholds. Test: `each_admin_call_after_setup_asks_the_admin_for_one_signature` ([R4](./THREAT_MODEL.md#r4-an-authoritys-keys)).
**Spoof.1.R.2** - Recommended: make each authority a Stellar multisig account with keys held by different people, and read its signers and thresholds on the network before going live (IP.1).
**Spoof.1.R.3** - In place: after setup, code, roles and wiring change only through the timelock, so holders see a takeover's changes days before they land. Test: `applying_before_the_eta_is_refused` ([R1](./THREAT_MODEL.md#r1-governance-compromised-the-changes-that-wait)).
**Spoof.2.R.1** - In place: the `/sign` page decodes the transaction and refuses anything it cannot show in full: a fee bump, a second operation, another contract, an operation the console does not offer, arguments of the wrong shape. Test: "refuses a contract that is not one of the configured four" ([R12](./THREAT_MODEL.md#r12-a-crafted-transaction-on-the-consoles-signing-page)).
**Spoof.2.R.2** - Accepted, because the kit cannot control who serves a web page: a console hosted by someone else can show anything. Each operator hosts its own, and each signer reads the call in their wallet. Remaining risk: a signer who signs without reading.
**Spoof.3.R.1** - In place: only the verifier's admin (compliance) lists, and the vault checks the verifier before any cash moves. Test: `an_investor_who_was_never_allowlisted_is_refused_before_any_cash_moves` ([X4](./THREAT_MODEL.md#x4-a-delisted-holder)).
**Spoof.3.R.2** - In place: a verifier or rules swap waits for the timelock after setup, and a new verifier must accept the vault. Tests: `rule_and_verifier_swaps_wait_after_setup`, `a_verifier_that_stops_accepting_the_vault_is_never_installed` ([R11](./THREAT_MODEL.md#r11-swapping-the-tokens-compliance-contract-or-verifier)).
**Spoof.3.R.3** - Accepted, because the chain cannot check a person's identity: the KYC behind each listing is the operator's, and the kit's verifier is a testnet stub. Remaining risk: a careless or compromised compliance key lists the wrong address, and governance can install a verifier that accepts anyone, which holders see during the delay. Mainnet's registry is chosen in [#238](https://github.com/BootNodeDev/strata-vault-kit/issues/238).
**Spoof.4.R.1** - In place: an oracle swap waits for the timelock, and the new oracle must name this vault, have finished its setup and answer `state()` and `freshness_duration()` (`feed_bound_here_and_answering` in [`guards.rs`](../contracts/async-vault/src/guards.rs)). Tests: [O9](./THREAT_MODEL.md#o9-governance-changes-the-limits-or-the-feed).
**Spoof.4.R.2** - Recommended: alert on every proposed change ([monitoring plan P6](./MONITORING_PLAN.md#p6-change-proposed-to-the-timelock)), so holders can leave during the delay.
**Spoof.4.R.3** - Accepted, because the checks can catch wiring mistakes, not intent. Remaining risk: a contract governance writes can pass them and report any price; the delay is notice, not a guaranteed exit.
**Spoof.5.R.1** - In place: each request, cancellation and claim asks the named holder to sign, the vault has no operators, and a claim pays the holder. Tests: `request_deposit_needs_the_investor_authorisation`, `cancel_redeem_asks_the_holder_for_one_signature` ([X14](./THREAT_MODEL.md#x14-a-call-made-in-a-holders-name)). | +| **T**ampering | **Tamper.1.R.1** - In place: a report must sit in the band, move by no more than the maximum, come after the cooldown and carry its own expiry; the oracle stamps the time it took it. The guardian can pause the NAV and governance revokes the attester at once. Test: `attest_enforces_cooldown_and_deviation` ([O1](./THREAT_MODEL.md#o1-one-false-report-within-the-limits)); Certora proved the band, the maximum move, the cooldown and the config check ([scan](./SECURITY_SCAN.md#certora-sunbeam)).
**Tamper.1.R.2** - Recommended: make the attester a multisig, and alert on large moves and runs of reports one way ([monitoring plan V4](./MONITORING_PLAN.md#v4-a-large-step), [V5](./MONITORING_PLAN.md#v5-a-run-of-reports-one-way)).
**Tamper.1.R.3** - Accepted, because the chain cannot know the fund's true value; the limits bound how far each report moves it. Remaining risk: value moves between the holders who enter or leave in that epoch and those who stay.
**Tamper.2.R.1** - In place: each report must carry a proof hash that is not all zeros, and may carry a URI. Test: `a_report_without_a_proof_hash_is_refused` ([O10](./THREAT_MODEL.md#o10-the-proof-proves-nothing-on-chain)).
**Tamper.2.R.2** - Recommended: a reviewer fetches each report's evidence and compares its hash; the chain cannot check the evidence (IP.3).
**Tamper.3.R.1** - In place: only a report accepted at or after the seal prices an epoch, the oracle cuts a far expiry to its freshness window, and the cooldown and caps limit which reports can land before someone fulfils. Tests: `an_epoch_is_not_priced_against_a_valuation_older_than_its_close` ([O5](./THREAT_MODEL.md#o5-time-games)), `an_epoch_cannot_be_priced_inside_its_notice` ([O13](./THREAT_MODEL.md#o13-choosing-which-report-prices-an-epoch)).
**Tamper.3.R.2** - Recommended: run a keeper that fulfils each epoch as soon as its notice ends, so no one can wait for a better report ([scan finding A4](./SECURITY_SCAN.md#almanax)).
**Tamper.3.R.3** - Accepted, because the chain sees when a report was accepted, not when its valuation was made. Remaining risk: a report accepted after the seal can carry a valuation made before it (O5).
**Tamper.4.R.1** - In place: after setup, code and wiring changes wait at least seven days on the vault's timelock, are checked again when applied, and wait longer while the vault is paused; during a wind-down nothing lands except a grant of the token's `compliance` role. Tests: `applying_before_the_eta_is_refused`, `a_pause_freezes_the_upgrade_timelock_clock`, `nothing_timelocked_moves_during_a_wind_down_a_manager_revoke_included` ([R1](./THREAT_MODEL.md#r1-governance-compromised-the-changes-that-wait)).
**Tamper.5.R.1** - In place: conversions round down in the vault's favour and each claim rounds on its own. Test: `deposit_and_redeem_round_trip_never_manufactures_assets` ([X9](./THREAT_MODEL.md#x9-rounding-and-amounts-below-one-share)); Certora proved the deposit and redemption floors and that a round trip never gains ([scan](./SECURITY_SCAN.md#certora-sunbeam)).
**Tamper.6.R.1** - In place: a legal transfer needs compliance and governance in the same call, from two different accounts, to a destination that passes the identity check, and never moves shares out of or into the vault's address. Tests: `compliance_and_the_admin_move_shares_together`, `one_account_cannot_co_sign_with_itself`, `the_destination_must_pass_the_identity_check`, `nothing_leaves_the_vault_address` ([R10](./THREAT_MODEL.md#r10-compliance-and-governance-move-a-holders-shares-together)).
**Tamper.6.R.2** - Accepted, because moving shares on a legal order is a power the fund needs, and the kit splits it between two authorities. Remaining risk: both keys taken, or both acting wrongly; and governance can grant `compliance` to an account it controls after one delay, a wind-down included, and reach both signatures alone. | +| **R**epudiation | **Repudiate.1.R.1** - Recommended: make `allow` publish an event with the account and its new answer ([#441](https://github.com/BootNodeDev/strata-vault-kit/issues/441)).
**Repudiate.1.R.2** - Accepted until then, because the verifier is a testnet stub and a production registry publishes its own events. Remaining risk: a watcher that reads events misses every listing; `is_allowed` shows the current answer, and the signed transaction stays in the history archives ([R14](./THREAT_MODEL.md#r14-an-allowlist-change-that-publishes-no-event)).
**Repudiate.2.R.1** - In place: each report's proof hash ties it to its evidence, and `NavAttested` publishes it. Test: `attesting_publishes_the_stored_valuation` ([Repudiation](./THREAT_MODEL.md#repudiation)).
**Repudiate.2.R.2** - Recommended: the operator keeps each report's evidence for as long as the fund's records must be kept (IP.3).
**Repudiate.3.R.1** - In place: every privileged call that changes state publishes an event, except `allow` (Repudiate.1), and the transaction carries each signer's signature. Test: `proposing_and_applying_publish_the_change` on the vault, the token, the oracle and the compliance contract. Several of the kit's own privileged events, such as `Deployed` and `NavPausedSet`, have no test yet ([Repudiation](./THREAT_MODEL.md#repudiation)).
**Repudiate.3.R.2** - Recommended: run a watcher that stores each event as it reads it, inside the RPC's window ([monitoring plan](./MONITORING_PLAN.md#how-events-are-read-and-kept)); history beyond it is in the archives (IP.6).
**Repudiate.4.R.1** - Recommended: watch each authority's account through an account-history service ([monitoring plan](./MONITORING_PLAN.md#what-this-plan-does-not-cover)). | +| **I**nformation Disclosure | **Info.1.R.1** - Accepted, because the ledger is public on purpose: anyone can check the books without trusting the operator. Remaining risk: a holder who needs more privacy than a public ledger gives cannot get it from the kit.
**Info.1.R.2** - In place: the KYC data stays off chain; the kit's verifier stores only a yes or no per address (`allow` in [`identity-verifier/src/lib.rs`](../contracts/identity-verifier/src/lib.rs)).
**Info.2.R.1** - In place: the console puts the transaction after the link's `#`, which the browser does not send to its host, and the transaction expires seven days after it is built. Test: "sends an expired link back to the proposer without a share row" ([R13](./THREAT_MODEL.md#r13-a-signing-link-read-before-the-call-lands)).
**Info.2.R.2** - Recommended: signers share a link only with their co-signers, over a private channel, and the attester builds a report's transaction after the epoch is sealed.
**Info.3.R.1** - In place: once a sealed epoch's price is readable, cancellation closes. Test: `a_sealed_epoch_cannot_be_cancelled_while_it_can_be_priced` ([O6](./THREAT_MODEL.md#o6-declining-a-price-after-seeing-it)).
**Info.4.R.1** - Recommended: when the evidence is private, publish the hash alone (an empty URI) and give the evidence to whoever checks it ([O10](./THREAT_MODEL.md#o10-the-proof-proves-nothing-on-chain)). | +| **D**enial of Service | **DoS.1.R.1** - In place: when pricing stalls, sealed epochs reopen to cancellation, so escrow is never stuck behind the feed; only governance lifts a pause, and it can replace the guardian. Tests: `a_sealed_epoch_cancels_once_the_feed_goes_stale` ([X7](./THREAT_MODEL.md#x7-escrow-behind-stalled-pricing)), `the_guardian_pauses_the_nav_but_unpausing_needs_governance` ([O7](./THREAT_MODEL.md#o7-the-nav-pause-used-to-stall-pricing)).
**DoS.1.R.2** - Recommended: alert before a report expires and on every pause ([monitoring plan V1](./MONITORING_PLAN.md#v1-report-close-to-expiry), [P2](./MONITORING_PLAN.md#p2-nav-paused-or-lifted)).
**DoS.2.R.1** - In place: a claim pays when the reserve covers it, in any order; nothing goes to the custodian while anything is uncovered; after a clawback the vault refuses by name the cancellations, claims and deposits its balance cannot cover. Tests: `a_covered_claim_pays_while_a_larger_one_waits` ([X1](./THREAT_MODEL.md#x1-the-reserve-cannot-pay-a-priced-exit)), `a_cancellation_the_balance_cannot_cover_is_refused_by_name` ([X10](./THREAT_MODEL.md#x10-the-deposit-assets-issuer-freezes-or-claws-back-the-vaults-cash)).
**DoS.2.R.2** - Recommended: check the deposit asset's issuer flags before going live (IP.2).
**DoS.2.R.3** - Accepted, because the issuer's controls are outside the kit. Remaining risk: a freeze makes every cash exit fail inside the asset until it lifts, and in a wind-down a claim checks no coverage, so after a loss of reserve it can take deposit escrow ([Known limits](./THREAT_MODEL.md#known-limits)).
**DoS.3.R.1** - Accepted, because a module change must not land unannounced: removing a faulty module waits for the timelock, like adding one ([Known limits](./THREAT_MODEL.md#known-limits)). Remaining risk: exits wait that long, and a module that fails during a wind-down cannot be removed until [#437](https://github.com/BootNodeDev/strata-vault-kit/issues/437) lands.
**DoS.4.R.1** - In place: once governance has set a minimum epoch duration, anyone may seal an epoch that has run it. Test: `an_outsider_seals_once_the_minimum_has_run` ([R8](./THREAT_MODEL.md#r8-the-manager-stops-sealing-or-picks-the-moment)). With none set, exits at a price wait until governance replaces the manager.
**DoS.4.R.2** - Recommended: set a minimum epoch duration at deploy; [#436](https://github.com/BootNodeDev/strata-vault-kit/issues/436) flags a vault that closed setup without one.
**DoS.5.R.1** - Recommended: fix [#434](https://github.com/BootNodeDev/strata-vault-kit/issues/434) and [#445](https://github.com/BootNodeDev/strata-vault-kit/issues/445) in one change, so every request in an epoch can settle and the epoch reconciles.
**DoS.6.R.1** - Recommended: fix [#435](https://github.com/BootNodeDev/strata-vault-kit/issues/435), so a fresh report can replace an expired one inside the cooldown.
**DoS.7.R.1** - In place: every read and write extends the entry's lifetime. Test: `any_vault_read_restores_the_instance_ttl` ([X11](./THREAT_MODEL.md#x11-storage-that-expires)). Pricing and wind-down rounds read running totals, so their cost does not grow with the number of requests; no test measures it yet (IP.8).
**DoS.7.R.2** - Recommended: measure the cost of each call and contention in one ledger (IP.8).
**DoS.7.R.3** - Accepted, because no release changes a stored type yet. Remaining risk: the first release that does needs a test that upgrades over entries of the old shape ([X13](./THREAT_MODEL.md#x13-an-upgrade-cannot-read-what-the-vault-stored)). | +| **E**levation of Privilege | **Elevation.1.R.1** - In place: after setup, upgrades, grants and swaps wait for the timelock (Tamper.4.R.1).
**Elevation.1.R.2** - Accepted, because pauses, revocations and the deposit cap must act at once in an emergency. Remaining risk, from R2: with an attester, governance can set any price in the band at once, and with compliance it can move any holder's wallet shares at once.
**Elevation.1.R.3** - Recommended: governance as a multisig (Spoof.1.R.2), and an alert on every proposed and applied change ([monitoring plan P6](./MONITORING_PLAN.md#p6-change-proposed-to-the-timelock)).
**Elevation.2.R.1** - In place: the vault takes no request and moves no epoch until `finish_setup`, which refuses until every wiring check holds and its books are empty. Test: `a_deposit_before_setup_finishes_is_refused` ([R3](./THREAT_MODEL.md#r3-setup-left-open-or-wired-wrong)).
**Elevation.3.R.1** - In place: the vault's constructor refuses four pairs of equal addresses. Test: `the_treasury_may_not_also_be_governance` ([R5](./THREAT_MODEL.md#r5-one-account-in-several-seats)).
**Elevation.3.R.2** - Accepted, because the role checks are being redesigned so a deployment may choose to run every role from one key. Remaining risk: later grants and the other contracts' roles are not checked, and two accounts can share a signer; holders read each contract's role holders ([Known limits](./THREAT_MODEL.md#known-limits)).
**Elevation.4.R.1** - In place: the guardian can pause but not move funds, and the treasury moves only free reserve, only to the custodian, never while anything is uncovered. Tests: `the_guardian_pauses_but_only_governance_unpauses` ([R6](./THREAT_MODEL.md#r6-guardian-compromised)), `assets_owed_to_a_priced_redemption_cannot_be_deployed` ([R7](./THREAT_MODEL.md#r7-treasury-compromised)). | + +### Soroban checks + +| Check | Answer | +| --- | --- | +| `overflow-checks` in the release profile | On: `overflow-checks = true` in the workspace's [`Cargo.toml`](../Cargo.toml), so an overflow aborts the transaction. Pricing also uses checked math and fails with `AmountTooLarge`. | +| Upgrades through `update_current_contract_wasm` | The vault, the share token and the oracle upgrade through OpenZeppelin's `upgradeable::upgrade`, which calls it, and only by applying a code change after the timelock (flow 7, [R1](./THREAT_MODEL.md#r1-governance-compromised-the-changes-that-wait)). The identity verifier and compliance stubs have no upgrade entrypoint. Test: `applying_a_wasm_change_replaces_the_code` ([X13](./THREAT_MODEL.md#x13-an-upgrade-cannot-read-what-the-vault-stored)), which runs with the `upgrade_wasm` feature ([TESTING.md](./TESTING.md)). Reading entries of an older shape after an upgrade has no test yet (DoS.7.R.3). | +| `__constructor` and a second init | Every contract sets itself up in `__constructor` (for example [`async-vault/src/lib.rs`](../contracts/async-vault/src/lib.rs)), which the host runs once, when the contract is created, and never again, not even on an upgrade ([CAP-58](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0058.md)). No contract has an `initialize` entrypoint to call twice or front-run. | +| TTL and archival | Every entry the kit stores itself goes through `strata-storage`, which extends its lifetime on each read and write. OpenZeppelin extends its own entries when it reads them; role entries are the exception ([X11](./THREAT_MODEL.md#x11-storage-that-expires)). The monitoring plan watches what is close to archiving ([T1](./MONITORING_PLAN.md#t1-instance-or-code-close-to-archiving)). | +| `require_auth` on the right address | Holders' calls ask the named holder ([X14](./THREAT_MODEL.md#x14-a-call-made-in-a-holders-name)). Admin calls ask the stored admin; where an OpenZeppelin entrypoint takes a `caller` or `operator`, the contract checks that account's role, or that it is the admin, before asking it to sign ([authorization matrix](./AUTHORIZATION_MATRIX.md)). Each account signs once per call ([R4](./THREAT_MODEL.md#r4-an-authoritys-keys)). | + +## Did we do a good job? + +- **Has the data flow diagram been referenced since it was created?** Yes. + Every issue above names the steps it targets, except Repudiate.4, which + happens on an authority's own account outside the flows. The flows were + checked against the code. +- **Did the STRIDE model uncover any new design issues or concerns that had not + been previously addressed or thought of?** Yes. A signing link shows its call + before it lands + ([R13](./THREAT_MODEL.md#r13-a-signing-link-read-before-the-call-lands)), the + verifier stub lists and delists without an event + ([R14](./THREAT_MODEL.md#r14-an-allowlist-change-that-publishes-no-event), + [#441](https://github.com/BootNodeDev/strata-vault-kit/issues/441)), and two + risks had no threat of their own: a call in a holder's name + ([X14](./THREAT_MODEL.md#x14-a-call-made-in-a-holders-name)) and the choice + of which report prices an epoch + ([O13](./THREAT_MODEL.md#o13-choosing-which-report-prices-an-epoch)). +- **Did the treatments identified in the “What are we going to do about it” + section adequately address the issues identified?** Most issues have a + control in place with a test. The recommended ones are tracked in issues or + listed as investigation points below. The accepted ones give the reason and + the risk that remains. +- **Have additional issues been found after the threat model?** The security + scan found one new bug, a zero-asset redemption that stays stuck + ([#445](https://github.com/BootNodeDev/strata-vault-kit/issues/445)), and + confirmed [#434](https://github.com/BootNodeDev/strata-vault-kit/issues/434) + ([`SECURITY_SCAN.md`](./SECURITY_SCAN.md)). +- **Any additional thoughts or insights on the threat modeling process that + could help improve it next time?** Keep `THREAT_MODEL.md` as the single place + for controls and tests, and this document as its map; update both with each + release. The formal verification reached the pricing and oracle math but not + the flows that store and read state back (IP.7). + +### Investigation points + +What the repository cannot confirm: + +- **IP.1** - Each authority's account on the network: whether it is a multisig, + its signers and its thresholds + ([R4](./THREAT_MODEL.md#r4-an-authoritys-keys)). +- **IP.2** - The chosen deposit asset's issuer flags, such as clawback and + authorization required + ([X10](./THREAT_MODEL.md#x10-the-deposit-assets-issuer-freezes-or-claws-back-the-vaults-cash)). +- **IP.3** - The custodian's holdings and the evidence behind each report, and + how long the operator keeps it + ([O10](./THREAT_MODEL.md#o10-the-proof-proves-nothing-on-chain)). +- **IP.4** - Which identity registry and compliance modules mainnet uses + ([#238](https://github.com/BootNodeDev/strata-vault-kit/issues/238)). +- **IP.5** - Who hosts each console, and how + ([R12](./THREAT_MODEL.md#r12-a-crafted-transaction-on-the-consoles-signing-page)). +- **IP.6** - Whether the operator runs a watcher and keeps the events it reads + ([monitoring plan](./MONITORING_PLAN.md)). +- **IP.7** - The rules the formal verification could not decide: the vault flows + that store and read state back, a full `attest`, and the share token + ([`SECURITY_SCAN.md`](./SECURITY_SCAN.md#certora-sunbeam)). +- **IP.8** - The cost of each call, and contention between calls in one ledger + ([X12](./THREAT_MODEL.md#x12-resource-limits-contention-and-griefing)). diff --git a/docs/THREAT_MODEL.md b/docs/THREAT_MODEL.md index 9c8b3106..63e31b66 100644 --- a/docs/THREAT_MODEL.md +++ b/docs/THREAT_MODEL.md @@ -389,6 +389,28 @@ without checking the feed's state. `fulfill_is_rejected_while_the_nav_is_paused` in [`oracle_pricing.rs`](../contracts/async-vault/src/test/oracle_pricing.rs). +### O13. Choosing which report prices an epoch + +Once an epoch's notice ends, whoever calls `fulfill_epoch` picks the moment, +and with it which valid report prices the epoch. + +- **Control:** Requests are fixed when the epoch is sealed, and only a report + accepted at or after the seal can price it. Between the end of the notice and + the call, the cooldown limits how many reports can land and the caps limit + how far each one moves. Anyone may call `fulfill_epoch` as soon as the notice + ends. +- **Residual:** Whoever fulfils chooses among the reports accepted by then. A + holder who waits for a better report can be beaten by anyone who fulfils + first. A keeper that fulfils as soon as the notice ends removes the choice; + the kit runs none. +- **Tests:** `an_epoch_cannot_be_priced_inside_its_notice` in + [`notice.rs`](../contracts/async-vault/src/test/notice.rs); + `anyone_may_fulfill_a_closed_epoch` in + [`epochs.rs`](../contracts/async-vault/src/test/epochs.rs); + `attest_enforces_cooldown_and_deviation` in + [`nav-oracle/src/test/oracle.rs`](../contracts/nav-oracle/src/test/oracle.rs). + A keeper: none, because the kit runs no keeper. + ## Roles ### R1. Governance compromised: the changes that wait @@ -1300,6 +1322,31 @@ or queued changes. release changes a stored type yet. The failures above are read from the code, and a test belongs with the first release that changes one. +### X14. A call made in a holder's name + +Someone requests, cancels or claims for a holder who did not sign, to move the +holder's escrow or take their payout. + +- **Control:** Each request, cancellation and claim names its holder and asks + that holder to sign. The vault has no operators or approvals, so no other + account can act for a holder. A claim pays the holder, never the caller. A + wind-down claim for the vault's own address is refused (`NoEntitlement`). +- **Residual:** Whoever holds a holder's keys acts as that holder. A wallet that + signs without showing the call is outside the kit. +- **Tests:** `request_deposit_needs_the_investor_authorisation`, + `one_investor_signature_covers_the_request_and_the_transfer` and + `claiming_needs_the_investor_authorisation` in + [`deposit.rs`](../contracts/async-vault/src/test/deposit.rs); + `request_redeem_needs_the_holder_authorisation` in + [`redeem.rs`](../contracts/async-vault/src/test/redeem.rs); + `cancel_deposit_asks_the_holder_for_one_signature`, + `cancel_redeem_asks_the_holder_for_one_signature`, + `claim_redeem_asks_the_holder_for_one_signature` and + `claim_wind_down_asks_the_holder_for_one_signature` in + [`signatures.rs`](../contracts/async-vault/src/test/signatures.rs); + `the_vault_cannot_claim_against_its_own_escrowed_shares` in + [`wind_down.rs`](../contracts/async-vault/src/test/wind_down.rs). + ## STRIDE STRIDE sorts threats into six kinds: spoofing, tampering, repudiation, @@ -1308,6 +1355,8 @@ threats above are grouped by area instead. The table places each one under the kinds it belongs to. The sections after it say what each kind covers here, and cover in full the three that the threats above cover least: spoofing, repudiation and information disclosure. +[`STRIDE-threat-model.md`](./STRIDE-threat-model.md) presents the same threats +in the format of Stellar's STRIDE template, with a data flow diagram. ### Map @@ -1328,6 +1377,7 @@ of service. E: elevation of privilege. | [O10](#o10-the-proof-proves-nothing-on-chain) The proof proves nothing on chain | | x | x | | | | | [O11](#o11-an-oracle-upgraded-in-place-cannot-read-its-old-report) An oracle upgraded in place cannot read its old report | | | | | x | | | [O12](#o12-an-integrator-reads-a-price-the-vault-would-refuse) An integrator reads a price the vault would refuse | | x | | | | | +| [O13](#o13-choosing-which-report-prices-an-epoch) Choosing which report prices an epoch | | x | | | | | | [R1](#r1-governance-compromised-the-changes-that-wait) Governance compromised: the changes that wait | | x | | | | x | | [R2](#r2-governance-compromised-the-powers-that-act-at-once) Governance compromised: the powers that act at once | | x | | | x | x | | [R3](#r3-setup-left-open-or-wired-wrong) Setup left open, or wired wrong | | x | | | | x | @@ -1355,6 +1405,7 @@ of service. E: elevation of privilege. | [X11](#x11-storage-that-expires) Storage that expires | | | | | x | | | [X12](#x12-resource-limits-contention-and-griefing) Resource limits, contention and griefing | | | | | x | | | [X13](#x13-an-upgrade-cannot-read-what-the-vault-stored) An upgrade cannot read what the vault stored | | | | | x | | +| [X14](#x14-a-call-made-in-a-holders-name) A call made in a holder's name | x | | | | | | ### Spoofing @@ -1362,8 +1413,8 @@ Acting as another account, contract or person. What proves who is calling: - **Holders.** Each request, cancellation and claim names a holder, and the vault asks that holder to sign (`holder.require_auth()`). The vault has no - operators, so no one else can act for a holder. The calls anyone may make - check no role: pricing a sealed epoch, funding the vault, activating a + operators, so no one else can act for a holder (X14). The calls anyone may + make check no role: pricing a sealed epoch, funding the vault, activating a wind-down that is due, finalizing a round, and sealing an epoch that has run the minimum epoch duration. They act on ledger time and stored state, and `fund` asks only the payer to sign. @@ -1389,14 +1440,15 @@ Acting as another account, contract or person. What proves who is calling: copy of the console hosted by someone else can show anything; each operator hosts its own. -R4 and R12 hold the tests: one signature per account for each privileged call, -and the signing page's refusals. +R4, R12 and X14 hold the tests: one signature per account for each privileged +call, the signing page's refusals, and the holder's signature on each of their +calls. ### Tampering Changing the price, the books, the code, or a transaction before it is signed: -- the price: O1, O2, O3, O5, O8, O9, O10, O12; +- the price: O1, O2, O3, O5, O8, O9, O10, O12, O13; - code, roles and wiring: R1, R2, R3, R11; - what a holder is owed or paid: R10, X3, X8, X9, X10; - when an epoch is sealed: R8; From 24eeeeb7e1e9c5ac30a3e27e46e5738df6e5819f Mon Sep 17 00:00:00 2001 From: hpmaxi <358059+hpmaxi@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:17:13 -0300 Subject: [PATCH 3/3] docs: add the security scan and its remediation plan Record what the self-service security tools found in the contracts and how each finding was triaged. Scout is the tool of record: its version, command and raw report are committed, and its 28 hits match an earlier run on the tranche2 tag. Almanax, Certora Sunbeam and a check against the Soroban Security Portal add their findings and proofs. No critical, high or medium finding from the scanners is a new bug. The plan covers the three open bugs the sweep found or confirmed. --- .prettierignore | 3 + README.md | 3 + docs/SECURITY_SCAN.md | 232 +++++++++ docs/evidence/scout/command.txt | 117 +++++ docs/evidence/scout/scout-report.json | 715 ++++++++++++++++++++++++++ docs/evidence/scout/scout-report.md | 185 +++++++ 6 files changed, 1255 insertions(+) create mode 100644 docs/SECURITY_SCAN.md create mode 100644 docs/evidence/scout/command.txt create mode 100644 docs/evidence/scout/scout-report.json create mode 100644 docs/evidence/scout/scout-report.md diff --git a/.prettierignore b/.prettierignore index d6ca674c..003ae7df 100644 --- a/.prettierignore +++ b/.prettierignore @@ -24,3 +24,6 @@ playwright-report scripts/harness/deployed.*.json scripts/harness/runs + +# Raw security tool output, kept as the tool wrote it +docs/evidence/scout diff --git a/README.md b/README.md index 832ff71a..df752f8e 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ than its pending deposits, and once a wind-down is proposed. - [STRIDE threat model](./docs/STRIDE-threat-model.md) — the threat model in the format of Stellar's STRIDE template: a data flow diagram, numbered flows, issues for each category and their remediations. +- [Security scan](./docs/SECURITY_SCAN.md) — what the self-service security + tools found in the contracts, how each finding was triaged, and the plan for + what stays open. - [Monitoring plan](./docs/MONITORING_PLAN.md) — what an operator watches on chain, where each signal comes from, and what to do when it fires. - [Grant differences](./docs/GRANT_DIFFERENCES.md) — where the built kit diff --git a/docs/SECURITY_SCAN.md b/docs/SECURITY_SCAN.md new file mode 100644 index 00000000..67f58a46 --- /dev/null +++ b/docs/SECURITY_SCAN.md @@ -0,0 +1,232 @@ +# Security scan + +The results of the self-service security tools from +[Stellar's list](https://developers.stellar.org/docs/tools/developer-tools/security-tools) +on Strata's contracts, every finding with its triage, and the plan for what +stays open. Scout is the tool of record: its version, command and raw report +are below. Three more ran on the same code: Almanax, Certora Sunbeam, and a +check against the Soroban Security Portal. + +Every finding was checked by hand against the code. A tool's severity is its +own label; the triage is ours. + +## Scope + +- **Code.** The `tranche2` tag, commit `db90b95`. Almanax, Certora and the + portal check ran on it on 10 November 2026. Scout ran on 12 November 2026 on + a copy of commit `56b22d1`, whose contracts, crates and lockfile are the same + as the tag's. +- **Contracts.** `async-vault`, `share-token`, `nav-oracle`, + `identity-verifier` and `compliance`, and the shared crates `strata-bindings`, + `strata-storage` and `strata-timelock`. +- **Not covered.** The web app, the deployment scripts and settings, and the + OpenZeppelin libraries themselves. This is an automated sweep with a manual + triage, not an audit. + +## Result + +- Every critical, high and medium finding from Scout and Almanax is a false + positive or behaviour the design chose. +- One new bug, rated low: a zero-asset redemption from a delisted holder stays + stuck ([#445](https://github.com/BootNodeDev/strata-vault-kit/issues/445)). +- Certora proved the pricing and oracle guard math, reproduced the known + [#434](https://github.com/BootNodeDev/strata-vault-kit/issues/434), and showed + the state behind [#435](https://github.com/BootNodeDev/strata-vault-kit/issues/435) + is reachable. Both are medium bugs, open, and in the remediation plan. + +Triage values: **Fixed** (with its PR), **Open** (with its issue), **False +positive** (the tool is wrong, and why), **Accepted** (the tool is right about +the behaviour and the design chose it, and why). + +## Scout + +[Scout](https://www.coinfabrik.com/products/scout), CoinFabrik's static +analyzer, flags code patterns that are often risky without running the code. +It rates each pattern, not its real impact, so its "Critical" does not mean a +critical bug. + +- **Version.** `cargo-scout-audit 0.3.17`, from the Docker image + `coinfabrik/scout:0.3.17` + (`sha256:216faf0b3c413cbe69770b0e2f999b9d45fa5bcb481940e8af4be1a48a7a54a5`). + Its detectors build with the toolchain `nightly-2025-09-18`. +- **Crates.** One run over the whole Cargo workspace. Scout reports all eight + crates analysed: the five contracts and the three shared crates. +- **Command.** + + ```sh + docker run --rm --platform linux/amd64 \ + -e INPUT_TARGET=/scoutme -e INPUT_SCOUT_ARGS="--output-format json,md" \ + -v ":/scoutme" coinfabrik/scout:0.3.17 + ``` + + It ran on a copy of the repository so its build output stayed out of the + working tree. A git hook worked around a branch rename in one of Scout's + dependencies: dylint checks out rust-clippy's `master` branch, which is now + `main`. [`command.txt`](./evidence/scout/command.txt) has every step. +- **Raw report.** [`scout-report.json`](./evidence/scout/scout-report.json), + [`scout-report.md`](./evidence/scout/scout-report.md) and the console output + [`scout-console.log`](./evidence/scout/scout-console.log). The summary list at + the top of the markdown report miscounts two categories; its sections and the + JSON give the right counts. + +28 hits from 6 detectors, none of them a real bug. They are the same 28, at the +same lines, as an earlier Scout run on the `tranche2` tag. + +### Integer overflow or underflow: 9 hits, Scout "Critical", false positive + +The release build sets `overflow-checks = true` ([`Cargo.toml`](../Cargo.toml)), +so an overflow aborts the transaction instead of producing a wrong number. None +of these lines can reach the limits with real values. + +| Location | Code | Why it cannot overflow | +| --- | --- | --- | +| `contracts/async-vault/src/treasury.rs:25` | `held(e) - state::cancellable_escrow(e)` | Two amounts of the deposit asset, bounded by its supply | +| `contracts/async-vault/src/treasury.rs:31` | `(liquid_reserve(e) - state::committed(e) - wind_down::owed(e)).max(0)` | Amounts of the asset; the result stops at zero | +| `contracts/async-vault/src/treasury.rs:38` | `(state::committed(e) - liquid_reserve(e)).max(0)` | Amounts of the asset; the result stops at zero | +| `contracts/async-vault/src/lock_policy.rs:100` | `(balance - frozen).max(0)` | Share amounts; the result stops at zero | +| `contracts/nav-oracle/src/guards.rs:148` | `nav_per_share - last.nav_per_share` | Both prices sit inside the oracle's band | +| `contracts/nav-oracle/src/guards.rs:149` | `last.nav_per_share * (bps as i128) / BPS_DENOM` | A price inside the band times at most 10,000 | +| `contracts/async-vault/src/wind_down.rs:188` | `wd.round += 1` | A `u32` round counter: about 4 billion rounds | +| `crates/strata-timelock/src/queue.rs:53` | `id + 1` | A `u32` change id: about 4 billion proposals | +| `contracts/async-vault/src/governance.rs:181` | `i + 1` | An index in a check over four addresses | + +### Storage operation without access control: 5 hits, Scout "Medium", false positive + +None of the five lets an outsider grow storage or make others' calls fail. + +| Location | Code | Why | +| --- | --- | --- | +| `crates/strata-timelock/src/queue.rs:51` | `open.push_back(id)` when a change is proposed | Only the admin proposes, and the queue refuses a new entry once 16 wait (`MAX_PENDING`, checked at `queue.rs:41`) | +| `contracts/async-vault/src/governance.rs:312` | `out.push_back` in `pending()` | A list built in memory for a read-only view, over at most 16 ids | +| `contracts/compliance/src/governance.rs:145` | `out.push_back` in `pending()` | Same | +| `contracts/nav-oracle/src/governance.rs:157` | `out.push_back` in `pending()` | Same | +| `contracts/share-token/src/governance.rs:174` | `out.push_back` in `pending()` | Same | + +### Soroban version: 8 hits, Scout "Enhancement", accepted + +One hit per crate, at `lib.rs:1`, because `soroban-sdk` is pinned to `26.1.1` +and Scout sees `29.0.1` as the latest. The pin is deliberate: it matches the +OpenZeppelin `0.7.2` libraries, and the repository upgrades dependencies only +between milestones, each migration as its own issue +([AGENTS.md](../AGENTS.md)). The hits are in `async-vault`, `share-token`, +`nav-oracle`, `compliance`, `identity-verifier`, `strata-bindings`, +`strata-storage` and `strata-timelock`. + +### No event on a storage change: 4 hits, Scout "Enhancement", false positive + +| Location | Entrypoint | Events it publishes | +| --- | --- | --- | +| `contracts/async-vault/src/lib.rs:891` | `claim_deposit` | `DepositClaimed`, or `DepositRefunded`; `EpochReconciled` when the epoch settles | +| `contracts/async-vault/src/lib.rs:923` | `cancel_deposit` | `DepositCancelled` | +| `contracts/async-vault/src/lib.rs:956` | `cancel_redeem` | `RedeemCancelled` | +| `contracts/async-vault/src/lib.rs:1030` | `claim_redeem` | `RedeemClaimed`, or `RedeemCancelled` when a zero-asset claim returns the shares; `EpochReconciled` when the epoch settles | + +Each entrypoint calls into `deposit.rs` or `redeem.rs`, which publish the +events; Scout does not follow the call from `lib.rs`. Tests: +`cancelling_a_deposit_publishes_the_cancellation`, +`cancelling_a_redemption_publishes_the_cancellation` and +`claiming_the_last_deposit_publishes_the_shares_paid_and_the_settlement` in +[`events.rs`](../contracts/async-vault/src/test/events.rs). + +### `assert!` may panic: 1 hit, Scout "Enhancement", false positive + +`crates/strata-bindings/src/errors.rs:39`. The `assert!` sits inside a +`const _: () = { … }` block, so it runs when the crate compiles: it stops the +build if two contracts' error-code ranges overlap, and never runs on chain. + +### Unused return enum: 1 hit, Scout "Minor", accepted + +`contracts/async-vault/src/lib.rs:1307`, `Ok(governance::clock(e))`. `clock()` +returns a `Result` because it implements the shared `TimelockHost` trait, where +another contract's clock can fail. The vault's never does; the `Result` costs +nothing. + +## Almanax + +An AI auditor that reads the whole repository. 12 findings, all closed. + +| Id | Finding | Almanax | Triage | Why | Where we checked | +| --- | --- | --- | --- | --- | --- | +| A1 | The constructor can be called after deploy and reset the admin | High | False positive | `__constructor` runs only when the contract is created and never again, not even on an upgrade. Even if it ran, OpenZeppelin's `set_admin` refuses when an admin exists. | `contracts/share-token/src/contract.rs:48-66`; `stellar-access` `access_control/storage.rs:151-155` | +| A2 | The compliance hooks do not check the token's signature | Medium | False positive | The hooks `transferred`, `created` and `destroyed` start with `require_auth_from_bound_token`: only the bound token can call them. | `contracts/compliance/src/lib.rs:468-529`; `stellar-tokens` `rwa/compliance/storage.rs:194, 224, 254, 361-369` | +| A3 | Cancellation reopens when the oracle becomes unreadable | Medium | Accepted | The design reopens cancellation when the vault can no longer price a sealed epoch, so escrow is never stuck behind a dead feed. Only trusted roles or a report's expiry make the feed unreadable, and anyone can price while it is readable. | `contracts/async-vault/src/epoch.rs:28-63`; design doc, cancellation | +| A4 | Anyone can time which report prices an epoch | Medium | Accepted | An epoch is priced at the latest valid report at fulfil time. Requests are fixed at the seal; the only choice left is among reports accepted after it, limited by the cooldown and the maximum move. A keeper that fulfils as soon as the notice ends removes the choice (remediation plan). | `contracts/async-vault/src/epoch.rs:45-151`; `contracts/async-vault/src/lib.rs:1098` | +| A5 | The custodian can be set to the vault itself | Medium | False positive | A custodian change is checked when proposed and again when applied, and both refuse the vault's own address with `InvalidCustodian`. | `contracts/async-vault/src/treasury.rs:10-74`; `contracts/async-vault/src/guards.rs:159-163` | +| A6 | Anyone can finalize a wind-down round and lock reserves | Medium | Accepted | Finalizing is open so the operator cannot stall payouts once the cash is in. It uses only free reserve, which already leaves out priced redemptions and escrow that can still be cancelled. | `contracts/async-vault/src/wind_down.rs:163-200`; `contracts/async-vault/src/treasury.rs:30-31` | +| A7 | Settlement entries can be spammed in each epoch | Medium | False positive | Only the manager seals at will; anyone else waits the minimum epoch duration, 1 to 30 days, or cannot seal if none is set. Requests need a listed holder and real escrow, entries are never looped over, and the writer pays their rent. | `contracts/async-vault/src/settlement.rs:24-74`; `contracts/async-vault/src/lib.rs:1061` | +| A8 | Shares are minted without a compliance check | Medium | False positive | The share token's `mint` runs OpenZeppelin's RWA mint, which checks the identity verifier and the compliance contract and refuses with `MintNotCompliant`. | `contracts/async-vault/src/deposit.rs:104-106`; `contracts/share-token/src/contract.rs:670-673` | +| A9 | Persistent storage grows with each request | Low | False positive | Each entry needs the holder's signature, a listing, real escrow and room under the deposit cap, one per side per epoch. Entries are never looped over, the creator pays the rent, and untouched ones archive. | `contracts/async-vault/src/state.rs:112-134`; `contracts/async-vault/src/deposit.rs:17-28` | +| A10 | The NAV pause can be lost when a key expires | Low | False positive | Instance storage is one ledger entry with one lifetime. If it archives, the whole contract stops until it is restored, and restoring brings the pause back. | `contracts/nav-oracle/src/state.rs`, `nav_paused` | +| A11 | Position storage has no bound | Low | False positive | One entry per holder, written only by that holder's own signed call, never looped over. It must outlive a single payout, since the holder takes part in every later round. | `contracts/async-vault/src/wind_down.rs:146-274` | +| A12 | Settlement amounts accept negative values | Low | False positive | Every caller passes zero or a pricing result built from stored positive amounts and a positive price; no entrypoint forwards a caller's amount. A total that would go below zero aborts with `AccountingMismatch`. | `contracts/async-vault/src/settlement.rs:76-101`; `contracts/async-vault/src/state.rs:10-14` | + +## Soroban Security Portal + +The [Soroban Security Portal](https://sorobansecurity.com) is a public database of +vulnerabilities found in audits of other Stellar projects, not a scanner. Of +its 954 published vulnerabilities, the 340 rated critical, high or medium were +grouped into 16 kinds, and each kind was checked against Strata. + +| Kind | Example in the portal | Triage | Why | Where we checked | +| --- | --- | --- | --- | --- | +| A zero-asset redemption from a blocked holder stays stuck (P0A) | Found while checking rounding and claims | Open: [#445](https://github.com/BootNodeDev/strata-vault-kit/issues/445), low | Returning the shares needs an eligible holder, and cancelling is closed once the epoch is priced. The epoch then never reconciles, which also defeats the fix planned for #434. | `contracts/async-vault/src/redeem.rs` `claim` → `deliver`; `contracts/async-vault/src/guards.rs:356-365` | +| Missing signature check | #735 Reflector | False positive | Every entrypoint that moves funds or changes state asks the holder or the role holder to sign first. | `contracts/async-vault/src/deposit.rs:21`; `redeem.rs:17`; `lib.rs:1062` | +| Admin takeover or renounce | #746 Verseprop | False positive | `renounce_admin` always refuses, `set_role_admin` refuses, and a new admin goes through the timelock and must accept. | `contracts/async-vault/src/lib.rs:1223, 1236` | +| Unauthorized upgrade | #305 Wombat, #456 Axelar | False positive | An upgrade is a timelocked change, checked when proposed and when applied. | `contracts/async-vault/src/governance.rs:270-274` | +| Front-running or repeating initialization | #618 EquitX | False positive | Setup runs in `__constructor`, once, in the transaction that creates the contract. There is no `initialize` to front-run. | `contracts/async-vault/src/lib.rs:144`; `contracts/nav-oracle/src/lib.rs:392` | +| Expired or archived storage | #1018 Peridot | False positive | Every read and write goes through `strata-storage`, which extends the entry's lifetime. | `crates/strata-storage/src/lib.rs` | +| Instance storage that grows without limit | #834 HiYield | False positive | The only list in instance storage is the timelock queue, which refuses new entries once 16 wait. | `crates/strata-timelock/src/queue.rs:12, 41` | +| Loops that grow until they fail | #1029 Peridot, #559 GrantPicks | False positive | Epochs keep running totals, not lists of requests, so pricing and settlement never loop over holders. | `contracts/async-vault/src/epoch.rs`; `settlement.rs` | +| Rounding and precision | #778 OctoLend | False positive | Both directions round down, so the vault never pays more than it holds; the dust is tracked. | `contracts/async-vault/src/pricing.rs:23, 33` | +| Decimals mismatch between asset and shares | #484 Untangled, #841 HiYield | False positive | Setup requires the asset and the share token to have the same decimals. | `contracts/async-vault/src/governance.rs:215` | +| Arithmetic overflow | #494, #676 | False positive | The release build has `overflow-checks = true`, and pricing uses checked math that fails with `AmountTooLarge`. | `Cargo.toml:11`; `contracts/async-vault/src/pricing.rs:24` | +| Missing value read as zero | #773 OctoLend | False positive | A default of zero is used only for running totals that start at zero; a missing contract address aborts with `NotInitialized`. | `contracts/async-vault/src/state.rs:72, 142, 152, 172, 180` | +| Stale or manipulated price | #1025, #1038 Peridot | False positive | The vault prices only when the oracle reports a valid state, and the oracle enforces expiry, the band, the maximum move and the cooldown. The known gap is #435. | `contracts/async-vault/src/epoch.rs:33-36`; `contracts/nav-oracle/src/guards.rs:142-150` | +| Failing call to another contract | #1022 Peridot | False positive | Calls to the oracle and the verifier use the `try_` form and turn a failure into a named error or a safe default (the holder treated as delisted). | `contracts/async-vault/src/pricing.rs:48`; `epoch.rs:33`; `lock_policy.rs:27` | +| Share price inflation by donation | #801 Alula, #486, #1036 | False positive | The share price comes from the oracle, not the vault's balance. A donation can only use up the deposit cap. | `contracts/async-vault/src/pricing.rs:42-55` | +| Claiming twice | #920 Matrixdock, #1019 Peridot | False positive | Each request is marked claimed when paid and refused afterwards. | `contracts/async-vault/src/deposit.rs:95`; `redeem.rs:88`; `wind_down.rs:239` | +| Fee-on-transfer token | #944 SODAX, #1030 Peridot | Accepted | The deposit asset is assumed to be a Stellar Asset Contract, which charges no fee on transfer. Nothing checks it on chain, so an operator must not configure a token with fees. | `contracts/async-vault/src/deposit.rs:55` | + +Slippage and sandwich attacks (Strata has no AMM) and off-chain event handling +(Strata has no backend) do not apply. + +## Certora Sunbeam + +Formal verification: each rule is checked for every input, and each rule that +asserts something has a companion check that its path can be reached. The rules +and the jobs are not committed; each line gives the job id. + +| Rule | Contract | Result | Triage | Job | +| --- | --- | --- | --- | --- | +| A deposit gets the exact rounded-down share amount | vault | Proven | No finding | `deposit_shares_is_exact_floor` · 3060a11a · 27b09142 | +| A redemption pays the exact rounded-down asset amount | vault | Proven | No finding | `redeem_assets_is_exact_floor` · 3060a11a | +| A deposit then a redemption never returns more than went in | vault | Proven | No finding | `pricing_round_trip_never_gains` · 3060a11a | +| A new price moves by no more than the maximum | oracle | Proven | No finding | `deviation_guard_enforces_cap` · b3c20188 | +| A new price sits inside the band | oracle | Proven | No finding | `band_guard_enforces_band` · c4b67354 | +| Only a valid oracle config is accepted | oracle | Proven | No finding | `config_guard_admits_only_valid` · e9b55faa | +| A new report waits for the cooldown | oracle | Proven | No finding | `cooldown_guard_enforces_wait` · 439001d7 · 6ca705ec | +| A zero-share deposit refund can be blocked by cash dust | vault | Violated | Open: [#434](https://github.com/BootNodeDev/strata-vault-kit/issues/434) | `issue434_core_refund_covered` · a8adccfa · 2fe243c2 | +| A stale report inside its cooldown, with a valid fresh one refused | oracle | Reachable | Open: [#435](https://github.com/BootNodeDev/strata-vault-kit/issues/435) | `stale_in_cooldown_state_reachable` · 08800b56 | +| Epoch fulfil, end-of-epoch cleanup, full deposit and claim flows | vault | No result | Not decided | 5f779e40 · 9f195846 · 64042512 · 77518228 | +| Free reserve is never negative | vault | No result | Not decided | `free_reserve_never_negative` · 9c0cd8f7 | +| A full `attest`: pause, expiry, signer, stored report | oracle | No result | Not decided | `attest_can_succeed` · e4f92083 | +| Share token: supply, mint and burn roles, timelock | share token | No result | Not decided | 96fbf222 · 5b0cb834 · 874d8237 · dbfa52ac | + +"No result" is not a pass. The prover loses fields of a struct it writes to +storage and reads back, so rules that store and re-read state are out of its +reach. Flows over whole entrypoints timed out after 50 to 90 minutes, and on the +share token the prover reverts the token's call to the compliance contract. + +## Remediation plan + +Every critical, high and medium finding from Scout and Almanax is closed. What +stays open is the three bugs the sweep found or confirmed, and two +recommendations. Each open bug is fixed before the audit starts. + +| Item | Severity | Fix | Who | Tracked in | By | +| --- | --- | --- | --- | --- | --- | +| A zero-share deposit refund blocked by cash dust | Medium | Release the dust so the refund pays, in the same change as the next row | Strata team (BootNode) | [#434](https://github.com/BootNodeDev/strata-vault-kit/issues/434) | Before the audit starts | +| A zero-asset redemption from a delisted holder stays stuck (P0A) | Low | Let the request settle when the holder cannot receive its shares, for example by burning them as a wind-down claim does, so the epoch reconciles | Strata team (BootNode) | [#445](https://github.com/BootNodeDev/strata-vault-kit/issues/445) | With #434 | +| A stale report cannot be replaced inside its cooldown | Medium | Let a fresh report replace an expired one before the cooldown ends | Strata team (BootNode) | [#435](https://github.com/BootNodeDev/strata-vault-kit/issues/435) | Before the audit starts | +| Who picks the pricing report (A4) | Medium (Almanax), accepted | Run a keeper that fulfils each epoch as soon as its notice ends | The operator of each deployment | [O13](./THREAT_MODEL.md#o13-choosing-which-report-prices-an-epoch); [STRIDE Tamper.3.R.2](./STRIDE-threat-model.md#what-are-we-going-to-do-about-it) | Before going live | +| Rules Certora could not decide | Not decided | Rerun with a verification-only mock of the compliance call, and once the prover reads stored structs back | Strata team (BootNode) | [STRIDE IP.7](./STRIDE-threat-model.md#investigation-points) | No date | diff --git a/docs/evidence/scout/command.txt b/docs/evidence/scout/command.txt new file mode 100644 index 00000000..55571a2b --- /dev/null +++ b/docs/evidence/scout/command.txt @@ -0,0 +1,117 @@ +Scout static analysis run +========================= + +Date (UTC): 2026-11-12, run started 15:59:36Z, finished 16:10:58Z +Exit code: 0 + +Tool +---- +Image: coinfabrik/scout:0.3.17 +Image digest: coinfabrik/scout@sha256:216faf0b3c413cbe69770b0e2f999b9d45fa5bcb481940e8af4be1a48a7a54a5 +Image created: 2026-09-25T20:14:45Z, linux/amd64 (run under amd64 emulation on an Apple Silicon host, Docker 29.8.2) +Scout version: cargo-scout-audit 0.3.17 + (docker run --rm --platform linux/amd64 --entrypoint cargo coinfabrik/scout:0.3.17 scout-audit --version) +Detector toolchain: nightly-2025-09-18 (bundled in the image) + +Code analysed +------------- +Worktree HEAD: 32c6c7bcec2b0fde4e138c8120fb05d6f00d1515 +Tag tranche2: db90b9570af12deaace85b237678b69a8a912296 (git log -1 --format=%H db90b95) +Also equal to: 56b22d132350f2e2f26098dea1ca6734c588fd0a +`git diff db90b95 -- contracts crates Cargo.toml Cargo.lock rust-toolchain.toml` +is empty for both HEAD and 56b22d1. + +Scope: one run over the whole Cargo workspace (members = crates/*, contracts/*). +Scout reports all 8 crates as analysed: + contracts: async-vault, share-token, nav-oracle, compliance, identity-verifier + crates: strata-bindings, strata-storage, strata-timelock + +Step 1: copy the code to a scratch directory +------------------------------------------- +Scout writes its build output and reports into the project directory, so it ran +on a copy and the worktree was not touched. + + rsync -a --exclude target --exclude node_modules --exclude .git \ + / /scout/src/ + +The copy was checked against the tagged commit: + + git -C archive db90b95 contracts crates Cargo.toml Cargo.lock rust-toolchain.toml \ + | tar -x -C /scout/verify + diff -rq verify/contracts src/contracts && diff -rq verify/crates src/crates \ + && cmp verify/Cargo.lock src/Cargo.lock && cmp verify/Cargo.toml src/Cargo.toml \ + && cmp verify/rust-toolchain.toml src/rust-toolchain.toml + -> no differences + +Step 2: git hook for a dylint bug +--------------------------------- +Scout builds a dylint driver at run time. dylint_driver 4.1.2 clones +https://github.com/rust-lang/rust-clippy and checks out the branch "master". +Upstream renamed that branch to "main", so without help the driver build fails with: + Error: `revparse_ext` failed for `master` ... revspec 'master' not found +The hook below only creates a local "master" branch in that clone. It does not +change Scout, its detectors or the code under analysis. + +/scout/git-hooks/post-checkout: + #!/bin/sh + case "$(git remote get-url origin 2>/dev/null)" in + *rust-lang/rust-clippy*) + git rev-parse -q --verify refs/heads/master >/dev/null || git branch master HEAD ;; + esac + exit 0 + +Step 3: the Scout run +--------------------- +This uses the image's own entrypoint, as the scout-audit README shows. The +entrypoint runs, inside /scoutme: + cargo scout-audit --local-detectors /scout-audit/nightly --scout-source /scout-audit $INPUT_SCOUT_ARGS + + docker run --rm --name scout-run6 --platform linux/amd64 \ + -e SCOUT_OFFLINE=1 \ + -e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=core.hooksPath -e GIT_CONFIG_VALUE_0=/scout-fix/hooks \ + -v "/scout/git-hooks:/scout-fix/hooks:ro" \ + -e INPUT_TARGET=/scoutme \ + -e INPUT_SCOUT_ARGS="--output-format json,md" \ + -v "/scout/src:/scoutme" \ + coinfabrik/scout:0.3.17 + +Notes: +- SCOUT_OFFLINE=1 turns off only Scout's telemetry and its own update check. It + does not affect detectors. The soroban-version detector still queried crates.io + and reported: latest Soroban version "29.0.1", project version "26.1.1". +- rust-toolchain.toml pins 1.97.0, so rustup installed that toolchain in the + container for the cargo command. The analysis itself compiles with Scout's + nightly-2025-09-18 toolchain. + +Output files +------------ + scout-report.json Scout's JSON report (written as report.json, renamed) + scout-report.md Scout's markdown report (written as report.md, renamed) + scout-console.log Console output of the run, ANSI colour codes removed + +Results: 28 findings. + By severity: Critical 9, Medium 5, Minor 1, Enhancement 13 + integer_overflow_or_underflow 9 Critical + dos_unexpected_revert_with_storage 5 Medium + unused_return_enum 1 Minor + soroban_version 8 Enhancement + storage_change_events 4 Enhancement + assert_violation 1 Enhancement +The markdown report's "Issues found" list counts per category but names each +category after its first detector: "Assert Violation (2 results)" is the Error +Handling category (assert_violation 1 + unused_return_enum 1), and +"Soroban Version (12 results)" is Best Practices (soroban_version 8 + +storage_change_events 4). The per-detector sections and the JSON give the exact counts. + +Attempts that did not produce a report +-------------------------------------- +1. Worktree mounted read-only, CARGO_TARGET_DIR=/target set for the whole + container: hung. A nested `cargo install dylint-link` waited forever on the + lock of the shared target directory. +2. Worktree read-only, target dir passed only to cargo check: failed, because + Scout builds detectors in the project's default target dir (read-only). +3. Target dir set in a scratch .cargo/config.toml: failed on the rust-clippy + "master" checkout described in step 2. +4. Same, with the git hook: failed with "--target-dir cannot be used multiple + times" (an extra `-- --target-dir /target` clashed with the one Scout passes). +5. Stopped by hand in favour of the copy-based run above. diff --git a/docs/evidence/scout/scout-report.json b/docs/evidence/scout/scout-report.json new file mode 100644 index 00000000..8dfb8171 --- /dev/null +++ b/docs/evidence/scout/scout-report.json @@ -0,0 +1,715 @@ +{ + "name": "Scoutme", + "date": "2026-11-12", + "summary": { + "executed_on": [ + { + "name": "strata-bindings", + "id": "path+file:///scoutme/crates/strata-bindings#0.1.0", + "relative_path": "crates/strata-bindings/Cargo.toml", + "absolute_path": "/scoutme/crates/strata-bindings/Cargo.toml" + }, + { + "name": "strata-storage", + "id": "path+file:///scoutme/crates/strata-storage#0.1.0", + "relative_path": "crates/strata-storage/Cargo.toml", + "absolute_path": "/scoutme/crates/strata-storage/Cargo.toml" + }, + { + "name": "strata-timelock", + "id": "path+file:///scoutme/crates/strata-timelock#0.1.0", + "relative_path": "crates/strata-timelock/Cargo.toml", + "absolute_path": "/scoutme/crates/strata-timelock/Cargo.toml" + }, + { + "name": "async-vault", + "id": "path+file:///scoutme/contracts/async-vault#0.1.0", + "relative_path": "contracts/async-vault/Cargo.toml", + "absolute_path": "/scoutme/contracts/async-vault/Cargo.toml" + }, + { + "name": "compliance", + "id": "path+file:///scoutme/contracts/compliance#0.1.0", + "relative_path": "contracts/compliance/Cargo.toml", + "absolute_path": "/scoutme/contracts/compliance/Cargo.toml" + }, + { + "name": "identity-verifier", + "id": "path+file:///scoutme/contracts/identity-verifier#0.1.0", + "relative_path": "contracts/identity-verifier/Cargo.toml", + "absolute_path": "/scoutme/contracts/identity-verifier/Cargo.toml" + }, + { + "name": "nav-oracle", + "id": "path+file:///scoutme/contracts/nav-oracle#0.1.0", + "relative_path": "contracts/nav-oracle/Cargo.toml", + "absolute_path": "/scoutme/contracts/nav-oracle/Cargo.toml" + }, + { + "name": "share-token", + "id": "path+file:///scoutme/contracts/share-token#0.1.0", + "relative_path": "contracts/share-token/Cargo.toml", + "absolute_path": "/scoutme/contracts/share-token/Cargo.toml" + } + ], + "total_vulnerabilities": 28, + "by_severity": { + "medium": 5, + "minor": 1, + "enhancement": 13, + "critical": 9 + }, + "table": { + "header": { + "cells": [ + { + "content": "Crate", + "color": { + "Importance": "Header" + } + }, + { + "content": "Status", + "color": { + "Importance": "Header" + } + }, + { + "content": "Critical", + "color": { + "Importance": "Header" + } + }, + { + "content": "Medium", + "color": { + "Importance": "Header" + } + }, + { + "content": "Minor", + "color": { + "Importance": "Header" + } + }, + { + "content": "Enhancement", + "color": { + "Importance": "Header" + } + } + ] + }, + "rows": [ + { + "cells": [ + { + "content": "async_vault", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "6", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + }, + { + "content": "5", + "color": "Default" + } + ] + }, + { + "cells": [ + { + "content": "compliance", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + } + ] + }, + { + "cells": [ + { + "content": "identity_verifier", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + } + ] + }, + { + "cells": [ + { + "content": "nav_oracle", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "2", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + } + ] + }, + { + "cells": [ + { + "content": "share_token", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + } + ] + }, + { + "cells": [ + { + "content": "strata_bindings", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "2", + "color": "Default" + } + ] + }, + { + "cells": [ + { + "content": "strata_storage", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + } + ] + }, + { + "cells": [ + { + "content": "strata_timelock", + "color": "Default" + }, + { + "content": "Analyzed", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + }, + { + "content": "0", + "color": "Default" + }, + { + "content": "1", + "color": "Default" + } + ] + } + ] + } + }, + "categories": [ + { + "id": "DoS", + "name": "Dos Unexpected Revert With Storage", + "vulnerabilities": [ + { + "id": "dos_unexpected_revert_with_storage", + "name": "Dos Unexpected Revert With Storage", + "short_message": "This storage (vector or map) operation is called without access control", + "long_message": " It occurs by preventing transactions by other users from being successfully executed forcing the blockchain state to revert to its original state.", + "severity": "Medium", + "help": "https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/dos-unexpected-revert-with-storage" + } + ] + }, + { + "id": "Arithmetic", + "name": "Integer Overflow Or Underflow", + "vulnerabilities": [ + { + "id": "integer_overflow_or_underflow", + "name": "Integer Overflow Or Underflow", + "short_message": "Potential for integer arithmetic overflow/underflow. Consider checked, wrapping or saturating arithmetic.", + "long_message": "An overflow/underflow is typically caught and generates an error. When it is not caught, the operation will result in an inexact result which could lead to serious problems.", + "severity": "Critical", + "help": "https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/integer-overflow-or-underflow" + } + ] + }, + { + "id": "Error Handling", + "name": "Assert Violation", + "vulnerabilities": [ + { + "id": "assert_violation", + "name": "Assert Violation", + "short_message": "Assert causes panic. Instead, return a proper error.", + "long_message": "Using assert! macro in production code can cause unexpected panics. This violates best practices for smart contract error handling.", + "severity": "Enhancement", + "help": "https://coinfabrik.github.io/scout-audit/docs/detectors/rust/assert-violation" + }, + { + "id": "unused_return_enum", + "name": "Unused Return Enum", + "short_message": "If any of the variants (Ok/Err) is not used, the code could be simplified or it could imply a bug", + "long_message": "Soroban functions can return a Result enum with a custom error type. This is useful for the caller to know what went wrong when the message fails. The definition of the Result type enum consists of two variants: Ok and Err. If any of the variants is not used, the code could be simplified or it could imply a bug. ", + "severity": "Minor", + "help": "https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/unused-return-enum" + } + ] + }, + { + "id": "Best Practices", + "name": "Soroban Version", + "vulnerabilities": [ + { + "id": "soroban_version", + "name": "Soroban Version", + "short_message": "Use the latest version of Soroban", + "long_message": "Using a older version of Soroban can be dangerous, as it may have bugs or security issues. Use the latest version available.", + "severity": "Enhancement", + "help": "https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/soroban-version" + }, + { + "id": "storage_change_events", + "name": "Storage Change Events", + "short_message": "Consider emiting an event when storage is modified", + "long_message": "Emiting an event when storage changes is a good practice to make the contracts more transparent and usable to its clients and observers", + "severity": "Enhancement", + "help": "https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/storage-change-events" + } + ] + } + ], + "findings": [ + { + "id": 0, + "occurrence_index": 1, + "category_id": "Error Handling", + "vulnerability_id": "assert_violation", + "error_message": "[ENHANCEMENT] Assert causes panic. Instead, return a proper error.", + "span": "errors.rs:39:9 - 42:10", + "code_snippet": "assert!(\n ranges[i - 1].last < ranges[i].first,\n \"two contracts' error ranges overlap\"\n )", + "package": "crates", + "file_path": "crates/strata-bindings/src/errors.rs" + }, + { + "id": 1, + "occurrence_index": 1, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "crates", + "file_path": "crates/strata-storage/src/lib.rs" + }, + { + "id": 2, + "occurrence_index": 2, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "crates", + "file_path": "crates/strata-bindings/src/lib.rs" + }, + { + "id": 3, + "occurrence_index": 3, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "crates", + "file_path": "crates/strata-timelock/src/lib.rs" + }, + { + "id": 4, + "occurrence_index": 1, + "category_id": "DoS", + "vulnerability_id": "dos_unexpected_revert_with_storage", + "error_message": "[MEDIUM] This storage (vector or map) operation is called without access control", + "span": "queue.rs:51:10 - 51:19", + "code_snippet": "push_back", + "package": "crates", + "file_path": "crates/strata-timelock/src/queue.rs" + }, + { + "id": 5, + "occurrence_index": 1, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This addition operation could overflow.", + "span": "queue.rs:53:60 - 53:68", + "code_snippet": "(id + 1)", + "package": "crates", + "file_path": "crates/strata-timelock/src/queue.rs" + }, + { + "id": 6, + "occurrence_index": 4, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "contracts", + "file_path": "contracts/identity-verifier/src/lib.rs" + }, + { + "id": 7, + "occurrence_index": 5, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "contracts", + "file_path": "contracts/compliance/src/lib.rs" + }, + { + "id": 8, + "occurrence_index": 2, + "category_id": "DoS", + "vulnerability_id": "dos_unexpected_revert_with_storage", + "error_message": "[MEDIUM] This storage (vector or map) operation is called without access control", + "span": "governance.rs:145:17 - 145:26", + "code_snippet": "push_back", + "package": "contracts", + "file_path": "contracts/compliance/src/governance.rs" + }, + { + "id": 9, + "occurrence_index": 6, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "contracts", + "file_path": "contracts/nav-oracle/src/lib.rs" + }, + { + "id": 10, + "occurrence_index": 3, + "category_id": "DoS", + "vulnerability_id": "dos_unexpected_revert_with_storage", + "error_message": "[MEDIUM] This storage (vector or map) operation is called without access control", + "span": "governance.rs:157:17 - 157:26", + "code_snippet": "push_back", + "package": "contracts", + "file_path": "contracts/nav-oracle/src/governance.rs" + }, + { + "id": 11, + "occurrence_index": 2, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This subtraction operation could underflow.", + "span": "guards.rs:148:16 - 148:52", + "code_snippet": "(nav_per_share - last.nav_per_share)", + "package": "contracts", + "file_path": "contracts/nav-oracle/src/guards.rs" + }, + { + "id": 12, + "occurrence_index": 3, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This operation could overflow or underflow.", + "span": "guards.rs:149:17 - 149:63", + "code_snippet": "last.nav_per_share * (bps as i128) / BPS_DENOM", + "package": "contracts", + "file_path": "contracts/nav-oracle/src/guards.rs" + }, + { + "id": 13, + "occurrence_index": 7, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "contracts", + "file_path": "contracts/share-token/src/lib.rs" + }, + { + "id": 14, + "occurrence_index": 4, + "category_id": "DoS", + "vulnerability_id": "dos_unexpected_revert_with_storage", + "error_message": "[MEDIUM] This storage (vector or map) operation is called without access control", + "span": "governance.rs:174:17 - 174:26", + "code_snippet": "push_back", + "package": "contracts", + "file_path": "contracts/share-token/src/governance.rs" + }, + { + "id": 15, + "occurrence_index": 8, + "category_id": "Best Practices", + "vulnerability_id": "soroban_version", + "error_message": "[ENHANCEMENT] Use the latest version of Soroban", + "span": "lib.rs:1:1 - 1:1", + "code_snippet": "", + "package": "contracts", + "file_path": "contracts/async-vault/src/lib.rs" + }, + { + "id": 16, + "occurrence_index": 4, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This addition operation could overflow.", + "span": "governance.rs:181:33 - 181:38", + "code_snippet": "i + 1", + "package": "contracts", + "file_path": "contracts/async-vault/src/governance.rs" + }, + { + "id": 17, + "occurrence_index": 5, + "category_id": "DoS", + "vulnerability_id": "dos_unexpected_revert_with_storage", + "error_message": "[MEDIUM] This storage (vector or map) operation is called without access control", + "span": "governance.rs:312:17 - 312:26", + "code_snippet": "push_back", + "package": "contracts", + "file_path": "contracts/async-vault/src/governance.rs" + }, + { + "id": 18, + "occurrence_index": 5, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This subtraction operation could underflow.", + "span": "lock_policy.rs:100:5 - 100:23", + "code_snippet": "(balance - frozen)", + "package": "contracts", + "file_path": "contracts/async-vault/src/lock_policy.rs" + }, + { + "id": 19, + "occurrence_index": 6, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This subtraction operation could underflow.", + "span": "treasury.rs:25:5 - 25:43", + "code_snippet": "held(e) - state::cancellable_escrow(e)", + "package": "contracts", + "file_path": "contracts/async-vault/src/treasury.rs" + }, + { + "id": 20, + "occurrence_index": 7, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This operation could overflow or underflow.", + "span": "treasury.rs:31:5 - 31:67", + "code_snippet": "(liquid_reserve(e) - state::committed(e) - wind_down::owed(e))", + "package": "contracts", + "file_path": "contracts/async-vault/src/treasury.rs" + }, + { + "id": 21, + "occurrence_index": 8, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This subtraction operation could underflow.", + "span": "treasury.rs:38:5 - 38:46", + "code_snippet": "(state::committed(e) - liquid_reserve(e))", + "package": "contracts", + "file_path": "contracts/async-vault/src/treasury.rs" + }, + { + "id": 22, + "occurrence_index": 9, + "category_id": "Arithmetic", + "vulnerability_id": "integer_overflow_or_underflow", + "error_message": "[CRITICAL] This addition operation could overflow.", + "span": "wind_down.rs:188:5 - 188:18", + "code_snippet": "wd.round += 1", + "package": "contracts", + "file_path": "contracts/async-vault/src/wind_down.rs" + }, + { + "id": 23, + "occurrence_index": 1, + "category_id": "Error Handling", + "vulnerability_id": "unused_return_enum", + "error_message": "[MINOR] If any of the variants (Ok/Err) is not used, the code could be simplified or it could imply a bug", + "span": "lib.rs:1307:9 - 1307:33", + "code_snippet": "Ok(governance::clock(e))", + "package": "contracts", + "file_path": "contracts/async-vault/src/lib.rs" + }, + { + "id": 24, + "occurrence_index": 1, + "category_id": "Best Practices", + "vulnerability_id": "storage_change_events", + "error_message": "[ENHANCEMENT] Consider emiting an event when storage is modified", + "span": "lib.rs:891:5 - 891:74", + "code_snippet": "pub fn claim_deposit(e: &Env, holder: Address, epoch_id: u64) -> i128", + "package": "contracts", + "file_path": "contracts/async-vault/src/lib.rs" + }, + { + "id": 25, + "occurrence_index": 2, + "category_id": "Best Practices", + "vulnerability_id": "storage_change_events", + "error_message": "[ENHANCEMENT] Consider emiting an event when storage is modified", + "span": "lib.rs:1030:5 - 1030:73", + "code_snippet": "pub fn claim_redeem(e: &Env, holder: Address, epoch_id: u64) -> i128", + "package": "contracts", + "file_path": "contracts/async-vault/src/lib.rs" + }, + { + "id": 26, + "occurrence_index": 3, + "category_id": "Best Practices", + "vulnerability_id": "storage_change_events", + "error_message": "[ENHANCEMENT] Consider emiting an event when storage is modified", + "span": "lib.rs:956:5 - 956:74", + "code_snippet": "pub fn cancel_redeem(e: &Env, holder: Address, epoch_id: u64) -> i128", + "package": "contracts", + "file_path": "contracts/async-vault/src/lib.rs" + }, + { + "id": 27, + "occurrence_index": 4, + "category_id": "Best Practices", + "vulnerability_id": "storage_change_events", + "error_message": "[ENHANCEMENT] Consider emiting an event when storage is modified", + "span": "lib.rs:923:5 - 923:75", + "code_snippet": "pub fn cancel_deposit(e: &Env, holder: Address, epoch_id: u64) -> i128", + "package": "contracts", + "file_path": "contracts/async-vault/src/lib.rs" + } + ] +} \ No newline at end of file diff --git a/docs/evidence/scout/scout-report.md b/docs/evidence/scout/scout-report.md new file mode 100644 index 00000000..7112afd8 --- /dev/null +++ b/docs/evidence/scout/scout-report.md @@ -0,0 +1,185 @@ + + + + + + +# Scout Report - Scoutme - 2026-11-12 + +## Summary + +| Crate | Status | Critical | Medium | Minor | Enhancement | +| - | - | - | - | - | - | +| async_vault | Analyzed | 6 | 1 | 1 | 5 | +| compliance | Analyzed | 0 | 1 | 0 | 1 | +| identity_verifier | Analyzed | 0 | 0 | 0 | 1 | +| nav_oracle | Analyzed | 2 | 1 | 0 | 1 | +| share_token | Analyzed | 0 | 1 | 0 | 1 | +| strata_bindings | Analyzed | 0 | 0 | 0 | 2 | +| strata_storage | Analyzed | 0 | 0 | 0 | 1 | +| strata_timelock | Analyzed | 1 | 1 | 0 | 1 | + + +Issues found: + + + +- [Dos Unexpected Revert With Storage](#dos-unexpected-revert-with-storage) (5 results) (Medium) + +- [Integer Overflow Or Underflow](#integer-overflow-or-underflow) (9 results) (Critical) + +- [Assert Violation](#assert-violation) (2 results) (Enhancement) + +- [Soroban Version](#soroban-version) (12 results) (Enhancement) + + + +## DoS + + + +### Dos Unexpected Revert With Storage + +**Impact:** Medium + +**Issue:** This storage (vector or map) operation is called without access control + +**Description:** It occurs by preventing transactions by other users from being successfully executed forcing the blockchain state to revert to its original state. + +[**Learn More**](https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/dos-unexpected-revert-with-storage) + +#### Findings + +| ID | Package | File Location | +| --- | ------- | ------------- | +| 4 | crates | [queue.rs:51:10 - 51:19](crates/strata-timelock/src/queue.rs) | +| 8 | contracts | [governance.rs:145:17 - 145:26](contracts/compliance/src/governance.rs) | +| 10 | contracts | [governance.rs:157:17 - 157:26](contracts/nav-oracle/src/governance.rs) | +| 14 | contracts | [governance.rs:174:17 - 174:26](contracts/share-token/src/governance.rs) | +| 17 | contracts | [governance.rs:312:17 - 312:26](contracts/async-vault/src/governance.rs) | + + + +## Arithmetic + + + +### Integer Overflow Or Underflow + +**Impact:** Critical + +**Issue:** Potential for integer arithmetic overflow/underflow. Consider checked, wrapping or saturating arithmetic. + +**Description:** An overflow/underflow is typically caught and generates an error. When it is not caught, the operation will result in an inexact result which could lead to serious problems. + +[**Learn More**](https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/integer-overflow-or-underflow) + +#### Findings + +| ID | Package | File Location | +| --- | ------- | ------------- | +| 5 | crates | [queue.rs:53:60 - 53:68](crates/strata-timelock/src/queue.rs) | +| 11 | contracts | [guards.rs:148:16 - 148:52](contracts/nav-oracle/src/guards.rs) | +| 12 | contracts | [guards.rs:149:17 - 149:63](contracts/nav-oracle/src/guards.rs) | +| 16 | contracts | [governance.rs:181:33 - 181:38](contracts/async-vault/src/governance.rs) | +| 18 | contracts | [lock_policy.rs:100:5 - 100:23](contracts/async-vault/src/lock_policy.rs) | +| 19 | contracts | [treasury.rs:25:5 - 25:43](contracts/async-vault/src/treasury.rs) | +| 20 | contracts | [treasury.rs:31:5 - 31:67](contracts/async-vault/src/treasury.rs) | +| 21 | contracts | [treasury.rs:38:5 - 38:46](contracts/async-vault/src/treasury.rs) | +| 22 | contracts | [wind_down.rs:188:5 - 188:18](contracts/async-vault/src/wind_down.rs) | + + + +## Error Handling + + + +### Assert Violation + +**Impact:** Enhancement + +**Issue:** Assert causes panic. Instead, return a proper error. + +**Description:** Using assert! macro in production code can cause unexpected panics. This violates best practices for smart contract error handling. + +[**Learn More**](https://coinfabrik.github.io/scout-audit/docs/detectors/rust/assert-violation) + +#### Findings + +| ID | Package | File Location | +| --- | ------- | ------------- | +| 0 | crates | [errors.rs:39:9 - 42:10](crates/strata-bindings/src/errors.rs) | + + +### Unused Return Enum + +**Impact:** Minor + +**Issue:** If any of the variants (Ok/Err) is not used, the code could be simplified or it could imply a bug + +**Description:** Soroban functions can return a Result enum with a custom error type. This is useful for the caller to know what went wrong when the message fails. The definition of the Result type enum consists of two variants: Ok and Err. If any of the variants is not used, the code could be simplified or it could imply a bug. + +[**Learn More**](https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/unused-return-enum) + +#### Findings + +| ID | Package | File Location | +| --- | ------- | ------------- | +| 23 | contracts | [lib.rs:1307:9 - 1307:33](contracts/async-vault/src/lib.rs) | + + + +## Best Practices + + + +### Soroban Version + +**Impact:** Enhancement + +**Issue:** Use the latest version of Soroban + +**Description:** Using a older version of Soroban can be dangerous, as it may have bugs or security issues. Use the latest version available. + +[**Learn More**](https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/soroban-version) + +#### Findings + +| ID | Package | File Location | +| --- | ------- | ------------- | +| 1 | crates | [lib.rs:1:1 - 1:1](crates/strata-storage/src/lib.rs) | +| 2 | crates | [lib.rs:1:1 - 1:1](crates/strata-bindings/src/lib.rs) | +| 3 | crates | [lib.rs:1:1 - 1:1](crates/strata-timelock/src/lib.rs) | +| 6 | contracts | [lib.rs:1:1 - 1:1](contracts/identity-verifier/src/lib.rs) | +| 7 | contracts | [lib.rs:1:1 - 1:1](contracts/compliance/src/lib.rs) | +| 9 | contracts | [lib.rs:1:1 - 1:1](contracts/nav-oracle/src/lib.rs) | +| 13 | contracts | [lib.rs:1:1 - 1:1](contracts/share-token/src/lib.rs) | +| 15 | contracts | [lib.rs:1:1 - 1:1](contracts/async-vault/src/lib.rs) | + + +### Storage Change Events + +**Impact:** Enhancement + +**Issue:** Consider emiting an event when storage is modified + +**Description:** Emiting an event when storage changes is a good practice to make the contracts more transparent and usable to its clients and observers + +[**Learn More**](https://coinfabrik.github.io/scout-audit/docs/detectors/soroban/storage-change-events) + +#### Findings + +| ID | Package | File Location | +| --- | ------- | ------------- | +| 24 | contracts | [lib.rs:891:5 - 891:74](contracts/async-vault/src/lib.rs) | +| 25 | contracts | [lib.rs:1030:5 - 1030:73](contracts/async-vault/src/lib.rs) | +| 26 | contracts | [lib.rs:956:5 - 956:74](contracts/async-vault/src/lib.rs) | +| 27 | contracts | [lib.rs:923:5 - 923:75](contracts/async-vault/src/lib.rs) | + +