wifi-densepose/v2/crates
rUv 1df6d1e1ee
security(nvsim): guard degenerate input — config panic + NaN silent-corruption + ADR-177 (#1098)
* fix(nvsim): guard degenerate input — config-induced panic + NaN-state poisoning

Beyond-SOTA security review of the ADR-089 NV-diamond simulator (milestone #9,
crate 2 of 4). Two real degenerate-input findings, each pinned fails-on-old:

NVSIM-DT-01 (config panic/DoS, pipeline.rs): an external f_s_hz == 0 made
dt == +Inf, dt_us saturated to u64::MAX, and `sample * dt_us` panicked with
"attempt to multiply with overflow" at sample >= 2 (debug/WASM panic=abort;
garbage t_us in release). Fix: sanitise dt (non-finite/non-positive -> 1 µs
fallback), cap the u64 cast, and saturating_mul the timestamp.

NVSIM-NAN-01 (NaN-state poisoning, digitiser.rs): a non-finite scene parameter
(NaN dipole position / Inf moment / NaN loop radius) bypasses the near-field
clamp (NaN < R_MIN_M is false) and yields a NaN field; at the ADC `NaN as i32`
== 0 silently emitted b_pt=[0,0,0] with ADC_SATURATED CLEAR — indistinguishable
from a legit zero-field reading. Fix at the funnel: adc_quantise treats any
non-finite input as out-of-range -> clamps to code 0 AND raises the saturation
flag, so the corruption is visible downstream.

Determinism integrity, panic-free MagFrame deserialisation, and RNG seeding
confirmed clean with evidence. The published cross-machine witness
(cc8de9b0…93b4) is unchanged — guards only affect degenerate inputs.

cargo test -p nvsim --no-default-features: 50 -> 53 passed, 0 failed.
Workspace green; Python deterministic proof unchanged (f8e76f21…46f7a,
nvsim off the signal proof path). Needs ADR slot 177.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs(adr): ADR-177 — nvsim degenerate-input hardening

Records the 2 MEASURED MEDIUM fixes in 37764be55 (NVSIM-DT-01 config-induced
overflow panic / WASM-abort DoS; NVSIM-NAN-01 non-finite scene param →
silent fake zero-field reading with saturation flag clear) + 3 pins, and the
clean-with-evidence determinism/deser/div-by-zero verdict. Cross-machine
witness cc8de9b0…93b4 reproduces unchanged.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-15 10:55:04 -04:00
..
cog-ha-matter harden(cog-ha-matter crypto): domain-separate witness signing + verify_strict (signing chain otherwise sound — P2 crypto core verified) (#1080) 2026-06-14 19:04:09 -04:00
cog-person-count bench(cogs): steady-state CPU infer latency benches (ADR-163 T2) 2026-06-12 08:01:50 -04:00
cog-pose-estimation bench(cogs): steady-state CPU infer latency benches (ADR-163 T2) 2026-06-12 08:01:50 -04:00
homecore fix(homecore core): TOCTOU race dropped/reordered state_changed events under concurrent writers (~93k→0) + 2 fail-closed hardenings (#1087) 2026-06-14 22:28:05 -04:00
homecore-api fix(homecore-api security): auth-gate GET /api/ (was unauthenticated) + recover WS subscription on broadcast lag (#1076) 2026-06-14 16:48:57 -04:00
homecore-assist harden(assist security): bound untrusted utterance (DoS); cmd-injection/ReDoS/NaN/fail-open all proven clean with evidence (#1086) 2026-06-14 21:34:38 -04:00
homecore-automation fix(automation security): template-bomb DoS (100MB/11s render → fuel-bounded, HIGH) + delay panic-on-config (MEDIUM) (#1083) 2026-06-14 20:22:07 -04:00
homecore-hap docs(homecore-hap): comprehensive README — HomeKit bridge with 11 accessory types 2026-05-25 23:11:15 -04:00
homecore-migrate security(homecore-migrate): redact secret value from malformed secrets.yaml error (#1089) 2026-06-14 23:09:55 -04:00
homecore-plugin-example HOMECORE: native Rust/WASM/TS port of Home Assistant — ADRs 125-134 implementation (#800) 2026-05-25 22:47:48 -04:00
homecore-plugins feat(homecore-plugins): enforce plugin signature + capability isolation (ADR-162 P4/P5) 2026-06-12 01:33:52 -04:00
homecore-recorder fix(recorder): bound history query (memory-DoS) + add missing transactional purge (disk-DoS); SQL-injection & NaN dims clean (#1084) 2026-06-14 21:00:52 -04:00
homecore-server fix(homecore-automation): start engine + implement time/run-mode/choose/template (ADR-161 A3-A7) 2026-06-12 00:55:34 -04:00
nvsim security(nvsim): guard degenerate input — config panic + NaN silent-corruption + ADR-177 (#1098) 2026-06-15 10:55:04 -04:00
nvsim-server fix(security): audit — fix RUSTSEC vulns, clippy warnings, dead code (#769) 2026-05-23 05:36:13 -04:00
ruv-neural@1ece3afa33 chore: extract ruv-neural to ruvnet/ruv-neural, wire as submodule (#1019) 2026-06-11 18:12:51 -04:00
ruview-swarm security(ruview-swarm): fail-closed on NaN/Inf at the swarm-comm trust boundary + ADR-176 (#1096) 2026-06-15 09:55:40 -04:00
wifi-densepose-bfld fix(bfld security): close HIGH privacy-bypass in process_to_frame (identity surface leaked despite restrictive class) + JSON-injection (#1075) 2026-06-14 16:15:42 -04:00
wifi-densepose-calibration fix(calibration): NaN-poisoning silently disabled presence specialist (Features::from_series unguarded) + de-magic (#1077) 2026-06-14 17:22:20 -04:00
wifi-densepose-cli security(core,cli): pin CSI-deserialiser DoS-resistance + ADR-172 (clean-with-evidence) (#1091) 2026-06-14 23:58:09 -04:00
wifi-densepose-core security(core,cli): pin CSI-deserialiser DoS-resistance + ADR-172 (clean-with-evidence) (#1091) 2026-06-14 23:58:09 -04:00
wifi-densepose-desktop fix: revert config-dependent cargo-fix changes (kept only always-safe edits) 2026-06-12 08:56:26 -04:00
wifi-densepose-engine fix(engine security): close witness domain-separation collision in governed-trust cycle + prove privacy monotonicity (#1074) 2026-06-14 15:32:24 -04:00
wifi-densepose-geo fix(geo numerical): parse_hgt underflow/inf-grid (HIGH) + haversine asin-NaN; pointcloud confirmed-robust (NaN-poisoning class, 3rd find) (#1081) 2026-06-14 19:37:08 -04:00
wifi-densepose-hardware feat(beyond-sota): ADR-157 M1 — constant-time HMAC compare + MEASURED 5.57x native wlanapi scan (#1054) 2026-06-13 16:32:34 -04:00
wifi-densepose-mat ci(bench): compile-verify regression gate for v2 criterion benches + ADR-174 (#1094) 2026-06-15 08:26:38 -04:00
wifi-densepose-nn refactor(beyond-sota): ADR-155 M2 — host-verifiable §8 closeout (7 de-magic, 9 boundary tests, native-conv honest-null) (#1059) 2026-06-14 00:07:56 -04:00
wifi-densepose-occworld-candle feat(occworld): real conv encoder/decoder forward pass + honesty flag 2026-06-11 21:47:19 -04:00
wifi-densepose-pointcloud fix(geo numerical): parse_hgt underflow/inf-grid (HIGH) + haversine asin-NaN; pointcloud confirmed-robust (NaN-poisoning class, 3rd find) (#1081) 2026-06-14 19:37:08 -04:00
wifi-densepose-rufield feat(ADR-262 P3): live /api/field + /ws/field — RuView sensing speaks RuField (fail-closed egress) (#1071) 2026-06-14 13:55:41 -04:00
wifi-densepose-ruvector feat(ADR-261 M2): multi-bit + large-N ANN scaling study — measured, no crossover (refutes M1 prediction) (#1066) 2026-06-14 10:31:00 -04:00
wifi-densepose-sensing-server feat(ADR-262 P3): live /api/field + /ws/field — RuView sensing speaks RuField (fail-closed egress) (#1071) 2026-06-14 13:55:41 -04:00
wifi-densepose-signal refactor(beyond-sota): ADR-154 M3 — clear §7.4 P3 backlog (22 de-magic + 6 boundary tests, backlog 36→0) (#1057) 2026-06-13 19:36:05 -04:00
wifi-densepose-train feat(bench): int8 quantization of WiFlow-STD half pose model — MEASURED trade-off (ADR-175, honest negative) (#1095) 2026-06-15 09:16:22 -04:00
wifi-densepose-vitals fix(vitals safety): non-finite CSI frame permanently froze breathing+HR via IIR-state poisoning (self-heal) + noise-never-Valid pin (#1079) 2026-06-14 18:01:47 -04:00
wifi-densepose-wasm fix(security): audit — fix RUSTSEC vulns, clippy warnings, dead code (#769) 2026-05-23 05:36:13 -04:00
wifi-densepose-wasm-edge test(wasm-edge): synthetic-ground-truth validation harness for edge skills (ADR-160) 2026-06-13 00:33:51 -04:00
wifi-densepose-wifiscan feat(beyond-sota): ADR-157 M1 — constant-time HMAC compare + MEASURED 5.57x native wlanapi scan (#1054) 2026-06-13 16:32:34 -04:00
wifi-densepose-worldgraph Beyond-SOTA engine/signal/train improvements: mesh partition guard, FFT CIR solver, canonical frame decoder, falsifiable occupancy benchmark, governed streaming, adapter provenance (#1018) 2026-06-11 16:08:54 -04:00
wifi-densepose-worldmodel feat: per-room calibration system (ADR-151) + cognitum-v0 appliance integration spec (#989) 2026-06-10 15:21:09 -04:00
README.md chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00

README.md

WiFi-DensePose Rust Crates

License: MIT OR Apache-2.0 Rust 1.85+ Workspace RuVector v2.0.4 Tests

See through walls with WiFi. No cameras. No wearables. Just radio waves.

A modular Rust workspace for WiFi-based human pose estimation, vital sign monitoring, and disaster response using Channel State Information (CSI). Built on RuVector graph algorithms and the WiFi-DensePose research platform by rUv.


Performance

Operation Python v1 Rust v2 Speedup
CSI Preprocessing ~5 ms 5.19 us ~1000x
Phase Sanitization ~3 ms 3.84 us ~780x
Feature Extraction ~8 ms 9.03 us ~890x
Motion Detection ~1 ms 186 ns ~5400x
Full Pipeline ~15 ms 18.47 us ~810x
Vital Signs N/A 86 us (11,665 fps) --

Crate Overview

Core Foundation

Crate Description crates.io
wifi-densepose-core Types, traits, and utilities (CsiFrame, PoseEstimate, SignalProcessor) crates.io
wifi-densepose-config Configuration management (env, TOML, YAML) crates.io
wifi-densepose-db Database persistence (PostgreSQL, SQLite, Redis) crates.io

Signal Processing & Sensing

Crate Description RuVector Integration crates.io
wifi-densepose-signal SOTA CSI signal processing (6 algorithms from SpotFi, FarSense, Widar 3.0) ruvector-mincut, ruvector-attn-mincut, ruvector-attention, ruvector-solver crates.io
wifi-densepose-vitals Vital sign extraction: breathing (6-30 BPM) and heart rate (40-120 BPM) -- crates.io
wifi-densepose-wifiscan Multi-BSSID WiFi scanning for Windows-enhanced sensing -- crates.io

Neural Network & Training

Crate Description RuVector Integration crates.io
wifi-densepose-nn Multi-backend inference (ONNX, PyTorch, Candle) with DensePose head (24 body parts) -- crates.io
wifi-densepose-train Training pipeline with MM-Fi dataset, 114->56 subcarrier interpolation All 5 crates crates.io

Disaster Response

Crate Description RuVector Integration crates.io
wifi-densepose-mat Mass Casualty Assessment Tool -- survivor detection, triage, multi-AP localization ruvector-solver, ruvector-temporal-tensor crates.io

Hardware & Deployment

Crate Description crates.io
wifi-densepose-hardware ESP32, Intel 5300, Atheros CSI sensor interfaces (pure Rust, no FFI) crates.io
wifi-densepose-wasm WebAssembly bindings for browser-based disaster dashboard crates.io
wifi-densepose-sensing-server Axum server: ESP32 UDP ingestion, WebSocket broadcast, sensing UI crates.io

Applications

Crate Description crates.io
wifi-densepose-api REST + WebSocket API layer crates.io
wifi-densepose-cli Command-line tool for MAT disaster scanning crates.io

Architecture

                          wifi-densepose-core
                         (types, traits, errors)
                                  |
              +-------------------+-------------------+
              |                   |                   |
    wifi-densepose-signal   wifi-densepose-nn   wifi-densepose-hardware
    (CSI processing)        (inference)         (ESP32, Intel 5300)
    + ruvector-mincut       + ONNX Runtime          |
    + ruvector-attn-mincut  + PyTorch (tch)   wifi-densepose-vitals
    + ruvector-attention    + Candle          (breathing, heart rate)
    + ruvector-solver            |
              |                  |             wifi-densepose-wifiscan
              +--------+---------+            (BSSID scanning)
                       |
          +------------+------------+
          |                         |
  wifi-densepose-train    wifi-densepose-mat
  (training pipeline)     (disaster response)
  + ALL 5 ruvector        + ruvector-solver
                          + ruvector-temporal-tensor
                                |
              +-----------------+-----------------+
              |                 |                 |
    wifi-densepose-api  wifi-densepose-wasm  wifi-densepose-cli
    (REST/WS)           (browser WASM)       (CLI tool)
              |
    wifi-densepose-sensing-server
    (Axum + WebSocket)

RuVector Integration

All RuVector crates at v2.0.4 from crates.io:

RuVector Crate Used In Purpose
ruvector-mincut signal, train Dynamic min-cut for subcarrier selection & person matching
ruvector-attn-mincut signal, train Attention-weighted min-cut for antenna gating & spectrograms
ruvector-temporal-tensor train, mat Tiered temporal compression (4-10x memory reduction)
ruvector-solver signal, train, mat Sparse Neumann solver for interpolation & triangulation
ruvector-attention signal, train Scaled dot-product attention for spatial features & BVP

Signal Processing Algorithms

Six state-of-the-art algorithms implemented in wifi-densepose-signal:

Algorithm Paper Year Module
Conjugate Multiplication SpotFi (SIGCOMM) 2015 csi_ratio.rs
Hampel Filter WiGest 2015 hampel.rs
Fresnel Zone Model FarSense (MobiCom) 2019 fresnel.rs
CSI Spectrogram Standard STFT 2018+ spectrogram.rs
Subcarrier Selection WiDance (MobiCom) 2017 subcarrier_selection.rs
Body Velocity Profile Widar 3.0 (MobiSys) 2019 bvp.rs

Quick Start

As a Library

use wifi_densepose_core::{CsiFrame, CsiMetadata, SignalProcessor};
use wifi_densepose_signal::{CsiProcessor, CsiProcessorConfig};

// Configure the CSI processor
let config = CsiProcessorConfig::default();
let processor = CsiProcessor::new(config);

// Process a CSI frame
let frame = CsiFrame { /* ... */ };
let processed = processor.process(&frame)?;

Vital Sign Monitoring

use wifi_densepose_vitals::{
    CsiVitalPreprocessor, BreathingExtractor, HeartRateExtractor,
    VitalAnomalyDetector,
};

let mut preprocessor = CsiVitalPreprocessor::new(56); // 56 subcarriers
let mut breathing = BreathingExtractor::new(100.0);    // 100 Hz sample rate
let mut heartrate = HeartRateExtractor::new(100.0);

// Feed CSI frames and extract vitals
for frame in csi_stream {
    let residuals = preprocessor.update(&frame.amplitudes);
    if let Some(bpm) = breathing.push_residuals(&residuals) {
        println!("Breathing: {:.1} BPM", bpm);
    }
}

Disaster Response (MAT)

use wifi_densepose_mat::{DisasterResponse, DisasterConfig, DisasterType};

let config = DisasterConfig {
    disaster_type: DisasterType::Earthquake,
    max_scan_zones: 16,
    ..Default::default()
};

let mut responder = DisasterResponse::new(config);
responder.add_scan_zone(zone)?;
responder.start_continuous_scan().await?;

Hardware (ESP32)

use wifi_densepose_hardware::{Esp32CsiParser, CsiFrame};

let parser = Esp32CsiParser::new();
let raw_bytes: &[u8] = /* UDP packet from ESP32 */;
let frame: CsiFrame = parser.parse(raw_bytes)?;
println!("RSSI: {} dBm, {} subcarriers", frame.metadata.rssi, frame.subcarriers.len());

Training

# Check training crate (no GPU needed)
cargo check -p wifi-densepose-train --no-default-features

# Run training with GPU (requires tch/libtorch)
cargo run -p wifi-densepose-train --features tch-backend --bin train -- \
    --config training.toml --dataset /path/to/mmfi

# Verify deterministic training proof
cargo run -p wifi-densepose-train --features tch-backend --bin verify-training

Building

# Clone the repository
git clone https://github.com/ruvnet/wifi-densepose.git
cd wifi-densepose/v2

# Check workspace (no GPU dependencies)
cargo check --workspace --no-default-features

# Run all tests
cargo test --workspace --no-default-features

# Build release
cargo build --release --workspace

Feature Flags

Crate Feature Description
wifi-densepose-nn onnx (default) ONNX Runtime backend
wifi-densepose-nn tch-backend PyTorch (libtorch) backend
wifi-densepose-nn candle-backend Candle (pure Rust) backend
wifi-densepose-nn cuda CUDA GPU acceleration
wifi-densepose-train tch-backend Enable GPU training modules
wifi-densepose-mat ruvector (default) RuVector graph algorithms
wifi-densepose-mat api (default) REST + WebSocket API
wifi-densepose-mat distributed Multi-node coordination
wifi-densepose-mat drone Drone-mounted scanning
wifi-densepose-hardware esp32 ESP32 protocol support
wifi-densepose-hardware intel5300 Intel 5300 CSI Tool
wifi-densepose-hardware linux-wifi Linux commodity WiFi
wifi-densepose-wifiscan wlanapi Windows WLAN API async scanning
wifi-densepose-core serde Serialization support
wifi-densepose-core async Async trait support

Testing

# Unit tests (all crates)
cargo test --workspace --no-default-features

# Signal processing benchmarks
cargo bench -p wifi-densepose-signal

# Training benchmarks
cargo bench -p wifi-densepose-train --no-default-features

# Detection benchmarks
cargo bench -p wifi-densepose-mat

Supported Hardware

Hardware Crate Feature CSI Subcarriers Cost
ESP32-S3 Mesh (3-6 nodes) hardware/esp32 52-56 ~$54
Intel 5300 NIC hardware/intel5300 30 ~$50
Atheros AR9580 hardware/linux-wifi 56 ~$100
Any WiFi (Windows/Linux) wifiscan RSSI-only $0

Architecture Decision Records

Key design decisions documented in docs/adr/:

ADR Title Status
ADR-014 SOTA Signal Processing Accepted
ADR-015 MM-Fi + Wi-Pose Training Datasets Accepted
ADR-016 RuVector Training Pipeline Accepted (Complete)
ADR-017 RuVector Signal + MAT Integration Accepted
ADR-021 Vital Sign Detection Pipeline Accepted
ADR-022 Windows WiFi Enhanced Sensing Accepted
ADR-024 Contrastive CSI Embedding Model Accepted
  • WiFi-DensePose -- Main repository (Python v1 + Rust v2)
  • RuVector -- Graph algorithms for neural networks (5 crates, v2.0.4)
  • rUv -- Creator and maintainer

License

All crates are dual-licensed under MIT OR Apache-2.0.

Copyright (c) 2024 rUv