> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sealforge.auction/llms.txt
> Use this file to discover all available pages before exploring further.

# Security

> Trust assumptions first, then the threat model summary, key custody, review findings and the mainnet gate checklist.

The canonical threat model is [`docs/THREAT-MODEL.md`](https://github.com/Udoka-AM/sealForge/blob/main/docs/THREAT-MODEL.md): assets, adversaries, what is and isn't protected, how, and the code or test that enforces each row. The security review with findings is [`docs/SECURITY-REVIEW.md`](https://github.com/Udoka-AM/sealForge/blob/main/docs/SECURITY-REVIEW.md). This page summarises both and holds the mainnet gate checklist.

## Trust assumptions

Stated first, because every guarantee depends on them. Full text: [THREAT-MODEL.md §Trust assumptions](https://github.com/Udoka-AM/sealForge/blob/main/docs/THREAT-MODEL.md#trust-assumptions).

1. **Deposit mode: the coordinator sees bid amounts live.** It holds the UFVK to scan. Trustees hold no viewing key. Use sealed-reveal mode to hide prices from the coordinator until the reveal window. Deposit sizes stay visible.
2. **The coordinator samples `nk` and `rivk` and holds the UFVK** (encrypted with `SF_DATA_KEY`). That is viewing power, not spending power.
   * A database dump plus `SF_DATA_KEY` gives an attacker every escrow's notes in both directions, so sealing breaks for deposit-mode amounts, and refund addresses leak. Funds don't move.
   * Two trustee shares give spend signatures. Building a spend also needs the escrow FVK, which lives only in the coordinator database under `SF_DATA_KEY`.
3. **Trustees check what they sign.** Trustees now receive the PCZT and run the shared frost-zec co-signer checks (`sealforge-verify`) plus sealForge's batch rules before committing and before signing: they compute the sighash themselves, check every spend is the escrow's and every randomizer matches, decrypt every output with the escrow's full viewing key (rebuilt from their own key share and tied to the address they attested), refuse hidden outputs, foreign pools, excess fee, padding and far expiries, and allow only: a consolidation that pays nobody, a payout of one output to the payout address, refunds of standard-size notes within what the published result owes. For refunds, trustees also read every claimed bid from the chain through a lightwallet server they chose and require each note to go to its bid's memo refund address and fit its refund split together with everything they signed before (a durable ledger; with 2-of-3 any two signing pairs share a trustee, so no note is paid twice). The browser trustee page runs the same checks (#54), through a lightwallet server the trustee sets on the page, and keeps its ledger in the browser's IndexedDB. What remains: the trustees trust the published result's refund amounts and the lightwallet server they chose, and the checks still need the external audit before mainnet.
4. **Liveness.** Refunds need the organiser to publish, the coordinator to build, and two trustees to sign. Any of them can delay. Funds stay in the escrow meanwhile.
5. **The published UIVK is permanent.** After publish, every deposit's amount and memo (code, commitment, refund address) and every reveal (price, salt) is readable by anyone, forever. Senders are not, and outgoing refunds are not.

## Threat model summary

| Adversary | Outcome |
| - | - |
| Chain observer during the auction | Sees nothing about bids |
| Chain observer after publish | Sees amounts and refund addresses, not senders |
| Organiser or coordinator publishing a false result | Detected by the chain audit |
| Hiding a bid from the published list | Detected within the audited block range |
| Coordinator, deposit mode | Sees amounts |
| Coordinator, sealed-reveal mode | Sees deposits, not prices, until the reveal window |
| Coordinator building a malicious spend | **Not protected** (assumption 3) |
| One rogue trustee | Can't sign |
| Coordinator during the DKG | Relays only. Signed and sealed packages, agreement check, fingerprint |
| Replay or forgery of API calls | `SF-Sig`, ±60 s, nonce store |
| Refund amount matching at the exit | Mitigated ([2.7](https://docs.sealforge.auction/protocol/refunds.md)) |
| Source-chain observer (ShieldRamp) | Not built |

Each row's mechanism and enforcing code: [THREAT-MODEL.md](https://github.com/Udoka-AM/sealForge/blob/main/docs/THREAT-MODEL.md#adversaries-and-protections).

## Key custody

The custody table (where each key lives and what stealing it gives) is in [SECURITY-REVIEW.md §Key handling](https://github.com/Udoka-AM/sealForge/blob/main/docs/SECURITY-REVIEW.md#key-handling-what-an-attacker-gets). One addition from this review: the escrow FVK components `nk` and `rivk` are generated by the coordinator ([3 Escrow key construction](https://docs.sealforge.auction/zcash-integration.md#escrow-key-construction)), and the PCZTs the coordinator builds are not shown to trustees.

## Findings

From the review on 2026-10-15 ([SECURITY-REVIEW.md](https://github.com/Udoka-AM/sealForge/blob/main/docs/SECURITY-REVIEW.md#findings-fixed-in-this-review)):

| # | Severity | Finding | Status |
| - | - | - | - |
| F1 | Medium | rustls advisories | Fixed (updated) |
| F2 | High | Unchecked refund address could block every refund batch, and a Sapling-only address crossed pools | Fixed, test `records_payments_with_memo_level_checks` |
| F3 | High (availability) | Concurrent DKG completion deadlocked | Fixed, row locks. `dkg_e2e` |
| F4 | Medium (availability) | An offline chosen signer stranded a batch | Fixed, 30-minute reset |
| F5 | Medium | No CSP or framing protection | Fixed, production CSP and `frame-ancestors 'none'` |
| F6 | Low | Escrow wallet files had default permissions | Fixed, 0700 |
| F7 | Low | `SF_DATA_KEY` visible in `ps` during the restore drill | Fixed, SQL over stdin |
| F8 | Medium | Late payments weren't refunded | Fixed, `late` status and late-refund planner |

Found while writing these docs (2026-11-13), not yet fixed:

| # | Severity | Finding | Where |
| - | - | - | - |
| D1 | **High** (fixed, pending audit) | Trustees signed a sighash without the PCZT. They now decode and check it (`sealforge-verify`, all 17 shared frost-zec tamper cases pass), tie every refund note to its bid's memo on chain, and keep a ledger against double payment (trust assumption 3). The browser trustee page has the same chain checks | `crates/sealforge-cli/src/trustee.rs` `sign_step`; `crates/sealforge-signer-wasm`; `BatchView` in `crates/sealforge-api/src/types.rs` |
| D2 | Medium | Three of four committed WASM modules were built from a dirty tree (`source_dirty: true`), so they can't be reproduced from the recorded commit. **Fixed** (#61): all four are built in a pinned container (`scripts/build-wasm.sh`), and CI fails unless the committed modules are clean builds that match a fresh build byte for byte | `infra/wasm-build/Dockerfile`; `scripts/check-wasm-builds.sh`; CI job `wasm` |
| D3 | Low | A transaction that expired unmined wasn't detected: the coordinator retried broadcasting it forever and every escrow scan failed meanwhile. **Fixed**: the batch is marked `expired` and rebuilt ([Batch states](https://docs.sealforge.auction/protocol/lifecycle.md#batch-states)); regtest: an unsigned refund past its expiry was replaced, signed and confirmed | `crates/sealforge-coordinator/src/scanner.rs` `expire_batches` |
| D4 | Low | Documented retention (UFVK and refund addresses deleted 30 days after settlement) was not implemented | Fixed (#65): an hourly retention job erases them, and the escrow wallet file, 30 days after settlement ([4 Architecture §Data model](https://docs.sealforge.auction/architecture.md#data-model)) |

## Open items from the review

| Item | Status |
| - | - |
| Rate limiting on public endpoints | Done (#58): per-client budgets for reads and writes, and a cap on requests in flight that keeps database connections free for the scanner and signing |
| Strict nonce-based CSP (drop `'unsafe-inline'`) | Done (#59) |
| Coordinator sees deposit-mode bids before close | By design. Sealed-reveal mode is the mitigation |
| Browser trustee holds the key share in JS memory while the page is open | Documented. The CLI is recommended for large auctions ([7 Guides](https://docs.sealforge.auction/guides.md#trustee)) |
| ShieldRamp transparent leg (PRD Q4) | Not built |

## Mainnet gate checklist

This is the canonical list; [10 Roadmap](https://docs.sealforge.auction/roadmap.md) links here. Each item MUST be done before an auction holds mainnet funds. Per-auction value caps were considered and decided against (#55): the trustee checks, the external review and independent trustees bound what a fault can do, and a cap would only limit the size of sale sealForge can serve.

* [ ] **Trustee-side transaction verification (D1).** Done for the transaction itself: trustees receive the PCZT, compute the sighash, run the shared frost-zec checks and sealForge's batch rules, and refuse otherwise (regtest evidence: every real consolidation, refund and payout checked and signed). Refund notes are tied to their bids on chain and double payment is refused (CLI; regtest evidence). Remaining: the external audit of these checks.
* [x] **Long-term trustee keys required on mainnet** (#67): the coordinator won't open a mainnet auction until all three trustees are certified, and the browser and the auditor fail the escrow check otherwise.
* [ ] **Independent trustees**: three different operators on separate infrastructure, not one operator's machines.
* [ ] **External review** of the escrow signing path (FROST over PCZT α, `apply_signatures`) and the DKG relay.
* [x] **Rate limiting** on public endpoints (#58): per-client read and write budgets in the coordinator, keyed by a salted hash of the client address (never stored or logged), plus a cap on requests in flight.
* [x] **Strict CSP** (#59): a per-response nonce with `'strict-dynamic'`; `'unsafe-inline'` is gone from `script-src`.
* [ ] **FROST ciphersuite from an upstream-published crate**, replacing `reddsa =0.5.2` and the deprecated fixed-α `sign` ([3 upstream risk](https://docs.sealforge.auction/zcash-integration.md#dependencies-and-upstream-risk)).
* [x] **Clean, reproducible WASM builds (D2)**: every `BUILD.json` with `"source_dirty": false`, reproduced by the CI `wasm` job (#61).
* [ ] **Off-site encrypted backups drilled** on the production host ([evidence/backup-drill.md](https://github.com/Udoka-AM/sealForge/blob/main/docs/evidence/backup-drill.md) lists what isn't drilled yet).
* [ ] **Rescan performance on real blocks** measured for the 3,500-block audit target ([evidence/perf.md](https://github.com/Udoka-AM/sealForge/blob/main/docs/evidence/perf.md)).
* [x] **Expiry handling for broadcast batches (D3).** Expired batches are marked `expired` and rebuilt.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.