Skip to content

audit F44 [quality]: WebTrustStore + state_bridge use Mutex panics on lock poison #544

@intendednull

Description

@intendednull

File: crates/web/src/trust_store.rs:92, 100, 116, 126, crates/web/src/state_bridge.rs:51, 73
Severity: quality
Obvious? no

These spots use .expect("WebTrustStore mutex poisoned") / .expect("cached mutex poisoned") to unwrap Mutex lock results. CLAUDE.md mandates StateActor or documented // state: lock-ok for every lock in lib crates.

trust_store.rs has no rationale comment, and the WASM single-threaded invariant means a Mutex is the wrong primitive — Rc<RefCell<T>> is the documented choice. Both a state-management policy violation and a pointless source of theoretical panics.

Fix: migrate trust_store.rs to Rc<RefCell<T>> (WASM single-threaded). For state_bridge.rs see also F38 — add a // state: lock-ok note duplicating the line-23 doc-comment justification.


Filed by /general-audit @ b901575 (2026-05-02). master: #513.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions