Keep nobilis memory-safe: forbid new unsafe and check advisories in CI #256

Open
opened 2026-10-02 19:03:42 -04:00 by Salastil · 0 comments
Owner

nobilis's own code is memory-safe Rust: two unsafe blocks in the whole daemon, both in main.rs, both sound and documented - mallopt(M_ARENA_MAX, 4) and malloc_trim(0), plain libc calls that take integers and touch no Rust memory. (The one mem::forget keeps the lock file's handle open for the process's life; a leak by intent, not a safety question.)

Nothing keeps it that way. Two things would:

  1. #![deny(unsafe_code)] at the crate root, with #[allow(unsafe_code)] on the two functions that need it - so a new unsafe block fails the build until somebody writes it down on purpose, with a SAFETY comment.
  2. An advisory check in the release workflow - cargo audit (or cargo deny check advisories) against the lockfile, failing on a vulnerability and warning on unmaintained crates. This audit found the issues filed alongside this one by querying OSV by hand; a machine should do that on every push.
nobilis's own code is memory-safe Rust: two `unsafe` blocks in the whole daemon, both in `main.rs`, both sound and documented - `mallopt(M_ARENA_MAX, 4)` and `malloc_trim(0)`, plain libc calls that take integers and touch no Rust memory. (The one `mem::forget` keeps the lock file's handle open for the process's life; a leak by intent, not a safety question.) Nothing keeps it that way. Two things would: 1. **`#![deny(unsafe_code)]`** at the crate root, with `#[allow(unsafe_code)]` on the two functions that need it - so a new `unsafe` block fails the build until somebody writes it down on purpose, with a SAFETY comment. 2. **An advisory check in the release workflow** - `cargo audit` (or `cargo deny check advisories`) against the lockfile, failing on a vulnerability and warning on unmaintained crates. This audit found the issues filed alongside this one by querying OSV by hand; a machine should do that on every push.
Salastil added this to the v1.0 milestone 2026-10-02 19:03:42 -04:00
Salastil added the featurelow priorityCVE labels 2026-10-02 19:03:42 -04:00
Salastil removed this from the v1.0 milestone 2026-10-03 21:29:55 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Salastil/moho#256