id: ffi-15 original_id: P.UNS.FFI.15 level: P impact: HIGH Validate Non-Robust External Values Summary Data received from external sources (FFI, files, network) may be invalid. Validate before using i
阅读全文
Separate Data and Code When Passing Rust Closures to C
id: ffi-16 original_id: P.UNS.FFI.16 level: P impact: HIGH Separate Data and Code When Passing Rust Closures to C Summary C callbacks are function pointers without captured state. To pass Rust closure
阅读全文
Avoid Passing Strings Directly to C from Public Rust API
id: ffi-01 original_id: P.UNS.FFI.01 level: P impact: HIGH Avoid Passing Strings Directly to C from Public Rust API Summary Use CString and CStr for string handling at FFI boundaries. Never pass Rust
阅读全文
Consider Safety When Manually Implementing Auto Traits
id: safety-05 original_id: P.UNS.SAS.05 level: P impact: CRITICAL clippy: non_send_fields_in_send_ty Consider Safety When Manually Implementing Auto Traits Summary When manually implementing Send or S
阅读全文
Avoid Passing Trait Objects to C Interfaces
id: ffi-18 original_id: P.UNS.FFI.18 level: P impact: HIGH Avoid Passing Trait Objects to C Interfaces Summary Trait objects (dyn Trait) have Rust-specific layout (fat pointers with vtable) that is no
阅读全文
Do Not Create Aliases for Types/Methods Named "Unsafe"
id: general-03 original_id: G.UNS.01 level: G impact: MEDIUM Do Not Create Aliases for Types/Methods Named "Unsafe" Summary Do not create type aliases, re-exports, or wrapper methods that hide the "un
阅读全文
Unsafe Checker - Section Definitions
Unsafe Checker - Section Definitions Section Overview #SectionPrefixLevelCountImpact 1General Principlesgeneral-CRITICAL3Foundational unsafe usage guidance 2Safety Abstractionsafety-CRITICAL11Building
阅读全文
Do Not Implement Drop for Types Passed to External Code
id: ffi-07 original_id: P.UNS.FFI.07 level: P impact: HIGH Do Not Implement Drop for Types Passed to External Code Summary If a type will be passed to external code that manages its lifetime, don't im
阅读全文
Prefer Reentrant Versions of C-API or Syscalls
id: mem-04 original_id: P.UNS.MEM.04 level: P impact: HIGH Prefer Reentrant Versions of C-API or Syscalls Summary When calling C functions or system calls, use reentrant (_r) versions to avoid data ra
阅读全文
Do Not Manually Convert Immutable Pointer to Mutable
id: ptr-05 original_id: G.UNS.PTR.02 level: G impact: CRITICAL clippy: cast_ref_to_mut Do Not Manually Convert Immutable Pointer to Mutable Summary Never cast *const T to *mut T and dereference it to
阅读全文