sb-dev/openquant / .agents/skills/rust-review
rust-review
VerifiedReview Rust crates, services, or libraries for safe/unsafe boundary issues, memory safety, concurrency hazards, panic-induced denial of service, FFI safety, and async runtime mistakes. Use for a Rust security audit, especially unsafe, FFI, or concurrent code.
upstream/prompts/general/refcell-borrow-panic-finder.md
View on GitHub---
name: refcell-borrow-panic-finder
description: Detects RefCell borrow/borrow_mut that panics at runtime due to overlapping borrows driven by reentrancy or callbacks
---
**Finding ID Prefix:** `REFCELLPANIC`.
**Bug shape:** `RefCell::borrow`/`borrow_mut` (commonly behind `Rc<RefCell<_>>`) panics at runtime when an incompatible borrow is already live. Reentrancy via callbacks, recursion, observers, or `Drop` running while a borrow is held — especially when an attacker controls the call sequence — turns a logic slip into a panic/DoS. (Drop-time borrow panics route to `DROPPANIC`; cross-thread reentrancy to the concurrency-locking reentrancy classes.)
**Gates:**
1. A `borrow_mut` (or `borrow`) is held across a call that can re-enter and borrow the same cell (callback, recursion, observer, `Drop`).
2. That path is reachable on untrusted-driven input.
**FPs:**
- `try_borrow`/`try_borrow_mut` used and the error handled.
- Borrows provably non-overlapping (no call out while a borrow is held).
- Single-threaded with no reentrancy path.
**Patch:** prefer `try_borrow*` with error handling; narrow each borrow's scope so none is held across a call-out; restructure to avoid reentrant borrows.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |