mirror of
https://github.com/ruvnet/RuView
synced 2026-08-11 20:41:44 +00:00
006a66ca20
Adds an `optimize` module that replaces the hand-picked shield config with a
derived, robustness-verified optimum, and hardens the experiment so the
collapse is proven to be signal-level, not classifier-level.
Model changes:
- throughput.rs: add a feedback-airtime term (cost rises with feedback bits)
alongside the falling quantization residual, giving a genuine interior
throughput optimum in feedback resolution.
- attacker.rs: add a selectable distance metric (Euclidean + Cosine) so the
optimizer can require the collapse to hold under multiple classifiers.
- experiment.rs: thread the attacker metric through; build the channel once.
optimize.rs:
- optimal_feedback_bits / spec_optimal_feedback_bits: throughput-best resolution
(3 bits unconstrained, matching DySPAN-2026; 5 bits within the 802.11 {5,7,9}
set).
- min_givens_passes: smallest mixing budget that collapses re-ID robustly across
both metrics AND N in {16,32}.
- pareto_frontier and hyper_optimize.
Findings and adopted defaults:
- Proven-minimum robust passes = 48; the hand-picked 112 was 2.3x over-
provisioned. Rotation mixing is keyed (never signaled), so extra passes are
throughput-free -> ship 96 (2x margin).
- Feedback resolution 5 bits (spec-optimal), down from 7.
- ShieldConfig::default() now equals hyper_optimize()'s output; a test guards
against drift.
Net vs. the original: strictly better on BOTH privacy and throughput.
Reference (SYNTHETIC/L0, N=16): re-ID 100% shield-off -> 4.7% shield-on
(chance 6.25%, below chance), throughput 97.6%, energy ratio 1.000000. 35 tests
+ doctest pass; clippy -D warnings clean; builds for wasm32.
Docs: new docs/research/privacy-shield/08-optimization.md; updated bundle
README/03/05/07 and ADR-288 with the derived operating point.
Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01WEXNqzs7UsfNFBcP5yW21p
86 lines
3.9 KiB
Rust
86 lines
3.9 KiB
Rust
//! # VEIL — a compliant-waveform privacy shield against WiFi sensing
|
|
//!
|
|
//! VEIL (Verifiable Emission-shaping for Identity-Leakage prevention) is the
|
|
//! countermeasure counterpart to BFLD (ADR-118/121, `wifi-densepose-bfld`).
|
|
//! Where BFLD *detects* when beamforming feedback becomes identifying, VEIL
|
|
//! *acts*: it shapes a node's own outgoing beamforming feedback so that an
|
|
//! unauthorized passive sniffer cannot re-identify people or infer activity,
|
|
//! while a legitimate receiver — which shares the per-session key — sees an
|
|
//! essentially unchanged link.
|
|
//!
|
|
//! This crate is a **deterministic, dependency-free, WASM-ready reference and
|
|
//! experiment**, not a radio driver. It models the physics faithfully enough to
|
|
//! measure the core claim, and it never emits RF. Per ADR-288 and CLAUDE.md,
|
|
//! every number it produces is `SYNTHETIC`, reproduced by
|
|
//! `cargo test -p wifi-densepose-privshield`.
|
|
//!
|
|
//! ## The idea in one paragraph
|
|
//!
|
|
//! Identity leaks through the *fine* cross-subcarrier phase structure of a
|
|
//! compressed beamforming report; data throughput rides the *dominant* beam
|
|
//! direction. These live in (mostly) separable subspaces. VEIL composes extra
|
|
//! keyed [`linalg::apply_givens`] rotations — the exact primitive the report is
|
|
//! already built from — over the **fine** subspace only. The rotation is:
|
|
//! orthogonal (energy-preserving ⇒ no added transmit power ⇒ **not jamming**,
|
|
//! [`compliance`]); keyed per session (the legitimate AP inverts it ⇒
|
|
//! throughput preserved, [`throughput`]); and fresh each session (a sniffer
|
|
//! sees a different rotation every time and cannot average back the signature
|
|
//! ⇒ re-identification collapses to chance, [`attacker`]/[`experiment`]).
|
|
//!
|
|
//! ## Threat model and scope (stated plainly)
|
|
//!
|
|
//! VEIL defends against a **third-party passive sniffer** capturing
|
|
//! plaintext beamforming feedback. It does **not** hide identity from the AP a
|
|
//! node is associated with (that party holds the key). It is **compliant by
|
|
//! construction**: it only shapes the node's own standards-conformant frames;
|
|
//! it never transmits to interfere with another station (47 U.S.C. §333) and
|
|
//! never operates an unauthorized emitter (§302a). It is not jamming, not RF
|
|
//! denial, and not a claim of camera-grade anything.
|
|
//!
|
|
//! ## Modules
|
|
//!
|
|
//! - [`prng`] — deterministic, WASM-safe PRNG and key derivation.
|
|
//! - [`linalg`] — the small Givens-rotation vector algebra.
|
|
//! - [`identity`] — the SYNTHETIC two-subspace beamforming-feedback model.
|
|
//! - [`protector`] — the compliant waveform controls (the shield).
|
|
//! - [`attacker`] — the passive re-identification adversary.
|
|
//! - [`throughput`] — the link-throughput model.
|
|
//! - [`compliance`] — the machine-checkable "not jamming" audit.
|
|
//! - [`experiment`] — the attacker-vs-protector head-to-head.
|
|
//! - [`proof`] — the byte-stable deterministic witness.
|
|
//!
|
|
//! ## Quick start
|
|
//!
|
|
//! ```
|
|
//! use wifi_densepose_privshield::experiment::{run, ExperimentConfig};
|
|
//!
|
|
//! let report = run(&ExperimentConfig::default());
|
|
//! assert!(report.attack_is_effective_without_shield()); // threat is real
|
|
//! assert!(report.drives_to_chance()); // shield collapses re-ID
|
|
//! assert!(report.preserves_throughput()); // throughput ≥ 95%
|
|
//! assert!(report.compliance.is_compliant()); // energy-preserving
|
|
//! ```
|
|
|
|
#![warn(missing_docs)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
pub mod attacker;
|
|
pub mod compliance;
|
|
pub mod experiment;
|
|
pub mod identity;
|
|
pub mod linalg;
|
|
pub mod optimize;
|
|
pub mod prng;
|
|
pub mod proof;
|
|
pub mod protector;
|
|
pub mod throughput;
|
|
|
|
pub use attacker::{Metric, NearestCentroidAttacker};
|
|
pub use compliance::ComplianceReport;
|
|
pub use experiment::{run, ExperimentConfig, ExperimentReport};
|
|
pub use identity::{BfiSample, Channel, SceneConfig};
|
|
pub use optimize::{hyper_optimize, HyperOptimized};
|
|
pub use proof::Proof;
|
|
pub use protector::{Protector, SensingDetector, ShieldConfig};
|
|
pub use throughput::LinkModel;
|