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/lossy-str-conversion-finder.md
View on GitHub---
name: lossy-str-conversion-finder
description: Detects silent lossy UTF-8 / OS-string / path conversions whose U+FFFD substitution corrupts a security-relevant value
---
**Finding ID Prefix:** `LOSSYSTR`.
**Gates:**
1. Lossy conversion that substitutes U+FFFD instead of failing: `from_utf8_lossy`, `to_string_lossy` (`OsStr`/`OsString`/`Path`/`CStr`), or a `to_str().unwrap_or_default()`-style fallback.
2. The bytes/`OsStr`/`Path` come from an untrusted source (filesystem entry, `args_os`, `var_os`, network).
3. The result feeds a security decision — filesystem path for open/read/write/delete, an allowlist/denylist or dedup key, an auth token — where divergence from the real bytes matters.
**FPs:**
- Used only for display/logging, never fed back to an OS or security decision.
- Caller already rejects non-UTF-8 (`from_utf8(..)?` / `to_str().ok_or(..)?`).
- Input is structurally guaranteed UTF-8.
**Patch:** use the fallible conversion (`str::from_utf8` / `Path::to_str` / `OsStr::to_str`) and error on invalid input; or keep operating on `OsStr`/`Path`/`&[u8]`.
Distinct from `LOSSYFROM` (numeric `From`/`Into`/`as` truncation). `from_utf8(..).unwrap()` on untrusted bytes is a panic — that's `UNWRAP`, not here.
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 |