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/clusters/resource-handling.md
View on GitHub---
name: cluster-resource-handling
kind: cluster
consolidated: false
covers:
- raw-fd-lifecycle # RAWFD
- destructor-skip # DROPSKIP
---
# Cluster: Resource and destructor handling
Non-memory OS resources (file descriptors, handles, sockets) and values whose `Drop` performs security-relevant cleanup (secrets, connections, transactions) follow the same ownership discipline as heap memory: every destructor runs exactly once on every exit path.
ID prefixes: `RAWFD`, `DROPSKIP`.
## Phase A
```
rg seed: "\b(from_raw_fd|into_raw_fd|as_raw_fd)\b"
rg seed: "\b(RawFd|OwnedFd|BorrowedFd)\b"
rg seed: "libc::(close|dup|dup2|open|pipe|socket)\b"
rg seed: "\b(RawHandle|RawSocket|from_raw_handle|into_raw_handle)\b"
rg seed: "\bmem::forget\b|\bManuallyDrop\b"
rg seed: "process::exit|libc::exit"
```
Run finders in declared order.
## Deconfliction
- `RAWFD` vs `DROPSKIP`: a file descriptor / handle / socket whose lifecycle is mishandled (double-close, leak, `from_raw_fd` without ownership transfer) is `RAWFD`. Any *other* security-relevant `Drop` skipped via `mem::forget` / `ManuallyDrop` / `process::exit` (secrets, connections, transactions, locks) is `DROPSKIP`. When a `mem::forget` / `ManuallyDrop` / `exit` strands an fd-backed value (`OwnedFd`, `File`, `TcpStream`), file `RAWFD` — the fd leak is the precise bug — and do **not** also file `DROPSKIP` for the same site.
- Foreign-allocator free mismatch on FFI-owned memory is `FOREIGNDROP` (ffi-cross-language cluster), not `RAWFD`/`DROPSKIP`.
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 |