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/unwrap-on-untrusted-finder.md
View on GitHub---
name: unwrap-on-untrusted-finder
description: Detects unwrap/expect on Result/Option flowing from attacker-controlled input
---
**Finding ID Prefix:** `UNWRAP`.
**Gates:**
1. `.unwrap()`, `.unwrap_err()`, or `.expect("...")` site.
2. The `Result`/`Option` is produced by parsing/decoding/lookup of external input (HTTP request, file content, IPC message, CLI arg, env var, untrusted serde input).
3. The panic is not reliably recovered. A `std::panic::catch_unwind` wrapper only counts as recovery under a `panic = "unwind"` build — under `panic = "abort"` (common on servers/embedded) `catch_unwind` is a no-op and the panic aborts the whole process, so an `unwrap` it "guards" is still a DoS and must be filed. Likewise `catch_unwind` cannot reliably stop a panic crossing an FFI/`extern` boundary. Treat "inside `catch_unwind`" as recovery only when the build is `panic = "unwind"` and the panic does not cross FFI.
**FPs (reject):**
- Statically infallible: parsing a hardcoded `&str` constant; unwrapping `Some(x)` where the producing path is provably surjective.
- Inside test code (`#[test]`, `#[cfg(test)]`).
- After explicit `is_ok()` / `is_some()` check immediately preceding.
**Patch:** replace with `?`, `match`, `unwrap_or(default)`, `unwrap_or_else(|e| ...)`, or `ok_or(err)`.
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 |