fix(desktop): M9-audit NICE stragglers — Rust batch #194

Merged
amiryahaya merged 2 commits from fix/m9-audit-nice-rust into main 2026-11-12 14:26:04 +01:00
Owner

Umbrella #167 NICE residue (desktop half).

Lockout ladder: BASE.min(BASE * 2^exp) had escalation as dead code (always 30s) while still evaluating the pow — overflow at failures-MAX > 64 (debug panic / release wrap; counter persists across sessions). Exponent clamped to 6, saturating ops, escalation live and capped at 900s. Overflow test seeds failures=130 (pre-fix panics in debug).

Chunk-container codec extracted from upload/download hot paths into chunk_container.rs with a full test set: roundtrips, truncation at every byte boundary, caps, hostile headers, wire-format stability pin.

crypto_service inline tests (AEAD core had zero): nonce-split wrap contract, wrong-KEK rejection, wrap/unwrap roundtrip + tamper + wrong-key.

Rust 56/56, desktop 1316/1skip, fmt/check clean.

Umbrella #167 NICE residue (desktop half). **Lockout ladder**: `BASE.min(BASE * 2^exp)` had escalation as dead code (always 30s) while still evaluating the pow — overflow at failures-MAX > 64 (debug panic / release wrap; counter persists across sessions). Exponent clamped to 6, saturating ops, escalation live and capped at 900s. Overflow test seeds failures=130 (pre-fix panics in debug). **Chunk-container codec** extracted from upload/download hot paths into `chunk_container.rs` with a full test set: roundtrips, truncation at every byte boundary, caps, hostile headers, wire-format stability pin. **crypto_service inline tests** (AEAD core had zero): nonce-split wrap contract, wrong-KEK rejection, wrap/unwrap roundtrip + tamper + wrong-key. Rust 56/56, desktop 1316/1skip, fmt/check clean.
fix(desktop): M9-audit NICE stragglers — Rust batch
Some checks failed
Security CI / security-scan (pull_request) Successful in 3m17s
Desktop CI / lint-and-test (pull_request) Failing after 9m16s
5fd7f179d0
- Lockout ladder: the backoff expression was BASE.min(BASE * 2^exp) —
  the leading .min made escalation DEAD CODE (always 30s) while still
  evaluating pow, which overflows once failures-MAX > 64 (debug panic /
  release wrap; the counter persists across sessions and grows one per
  lockout-expiry cycle). Fixed: exponent clamped to 6, saturating ops,
  escalation live again capped at MAX_SECS (900). Overflow test seeds
  failures=130 directly (pre-fix: panics in debug).

- Chunk-container codec extracted from the upload/download hot paths
  into chunk_container.rs with a full test set: roundtrips (empty /
  single / multi / boundary sizes), truncation at EVERY byte boundary,
  count + size caps, hostile-header rejection, and a wire-format
  stability pin (LE u32 count + LE u32 len + payload). Writer/reader
  drift can no longer corrupt user files silently.

- crypto_service inline tests (the AEAD core had ZERO): master-key wrap
  roundtrip + nonce-split contract (12-byte nonce, tag-length invariant),
  wrong-KEK rejection, wrap/unwrap roundtrip + tamper rejection,
  wrong-wrapping-key rejection.

Rust 56/56; desktop suite 1316/1skip; fmt + check clean.
amiryahaya force-pushed fix/m9-audit-nice-rust from 5fd7f179d0
Some checks failed
Security CI / security-scan (pull_request) Successful in 3m17s
Desktop CI / lint-and-test (pull_request) Failing after 9m16s
to ff102fa784
All checks were successful
Security CI / security-scan (pull_request) Successful in 2m21s
API CI / build-and-test (pull_request) Successful in 12m34s
Desktop CI / lint-and-test (pull_request) Successful in 15m2s
2026-11-12 14:01:11 +01:00
Compare
Sign in to join this conversation.
No description provided.