Daily Shaarli

All links of one day in a single page.

August 3, 2026

Pourquoi les États-Unis veulent s'emparer de l’électricité française ? - YouTube
Hardening Rust Code For Production | corrode Rust Consulting

Full of great explanations about securing (hardening) Rust code.

  • treat panic behavior as part of your API. Decide explicitly whether panics should unwind or abort, and avoid uncontrolled panics.
  • enable stricter Clippy lints (such as indexing and arithmetic checks) when panic freedom is important.
  • use a panic hook to shutdown gracefully, set reports, cleanup, collect diagnostics and
  • sanitize panic (and logging) messages while logging. veil is a good crate for that.
  • avoid unbounded recursion. Prefer iterative algorithms or use depth limits.
  • releases builds behave differently. They should be accordingly tested.
  • audit dependencies with cargo-audit and cargo-deny
  • secure allocation (for defense-in-depth when using unsafe code or FFI) with mimalloc or similar. Measure performance before enabling it globally.
  • use minimal runtime images if needed (rust distroless). It reduces the attack surface.
  • use multi-stage builds with cargo-chef, --locked and proper .dockerignore
  • avoid alpine musl lib c as it introduces subtle runtime differences; at least be aware of them.
  • use Linux landlock to restrict filesystem access even after compromission
  • never run as root unless absolutely necessary. Drop as much Linux capabilities as possible.
  • use Miri to detect undefined behavior, invalid pointer usage and unsafe-ode bugs.
  • handle SIGTERM/SIGINT properly. Stop accepting new work, finish inflight requests, flush buffers and then exit cleanly
  • protect external dependencies (database, API, cache) with circuit breakers so repeated failures don't cascade
  • put explicit limits on everything: upload size, request bodies, queues, timeouts, thread counts,
  • expose two health endpoints: a liveness probe and a readiness probe. The liveness probe checks if the process is alive at all, while the readiness probe checks if the process is healthy enough to handle traffic.
  • Use fuzzing (cargo-fuzz, honggfuzz), coverage (cargo-llvm-cov), unsafe detection (cargo-geiger), and memory-analysis tools alongside Rust's compile-time guarantees.
Your JSON Is Lying to You

Some pitfalls and cases where JSON has a default behavior.

Date, BigInt, circular dependencies, undefined property are not preserved and leads to different behaviors.

Serialization executes code and toJSON().

Take care of prototype pollutions (for example a __proto__ property).

There are also optimization with Message Pack that provides a compact ninary representation and CBOR.