Commit Graph

55 Commits

Author SHA1 Message Date
mnovak d62aa8f581 [domistream] Tests: closed XML depth bomb under the size cap
xml_depth_bomb_does_not_recurse: the closed half was 300 000 tag pairs
(2.1 MB), over MAX_XML_BYTES, so its `s.len() < MAX_XML_BYTES * 2` assert
failed and the depth check under it never ran (the protocol engineer was
right). Now 100 000 opens + 100 000 closes (about 0.7 MB): within the size
cap, it must be refused as TooLarge { max: MAX_XML_DEPTH }, without
recursion. The open-tags half is unchanged.
2026-11-26 03:53:14 +01:00
mnovak 6f13976ba5 [repo] Fuzz: lock file from the first full fuzz build 2026-11-26 03:47:20 +01:00
mnovak 61296102d1 [domistream] RTSP framer: collapse the Content-Length header check (clippy collapsible_if); clippy, fmt and doc clean 2026-11-26 03:12:17 +01:00
mnovak bd91a1007e [domistream] WIP: rustfmt, doc link, clippy fixes (one collapsible-if left in rtsp/mod.rs), PROTOCOL.md status
Paused at Mark's request.
2026-11-25 14:32:37 +01:00
mnovak 30a7b90034 [domistream] Implementation: HTTP, pairing, RTSP/SDP, ENet, control, input, RTP, FEC, video and audio receivers
Per PROTOCOL.md and the Wolf docs; interop with a real host is unverified. Strict, capped parsers throughout,
shared helpers in util.rs. Where PROTOCOL.md says UNKNOWN the Wolf-documented behaviour is used. The audio
receiver waits for the jitter budget before rebuilding a missing packet, so a late packet beats a rebuilt one.
2026-11-25 14:10:24 +01:00
mnovak 27b26a992b [domistream] Dependencies: rsa and x509-cert without default features (getrandom leaves the tree) 2026-11-25 14:10:23 +01:00
mnovak a939821124 [repo] Lab capture not run (Mark: continue without the check); ignore proptest regression files 2026-11-25 13:16:54 +01:00
mnovak 0f2edc66c9 [repo] Merge feature/lab: lab capture plan, relay tool, approved sources, U9/U14 from ENet and fec-rs 2026-11-25 13:16:40 +01:00
mnovak e67daea536 [domistream] Tests: properties cannot pass against Unimplemented
The never-panic properties (XML, RTSP, ENet, control, input, media) and the
allocation-cap checks only asserted inside `if let Ok`, so a stub returning
Unimplemented for everything passed them. Each now also requires the parser
to answer something other than Unimplemented (common::implemented); the XML
truncation property wants Malformed or Truncated, not any error.
2026-11-25 13:15:00 +01:00
mnovak 6c68a25b77 [repo] Lab capture: lab-install.ps1 (pinned MSI, loopback bind, one elevation) and lab-api.ps1 (pinned TLS, DPAPI credentials) 2026-11-25 13:08:46 +01:00
mnovak fd1c141ca8 [repo] Lab relay: compile fixes after the first build (clippy, fmt); 28 unit tests pass 2026-11-25 13:08:46 +01:00
mnovak 2740d3dd45 [domistream] Tests: first compile, clippy clean
Temporaries borrowed past their statement (control, media), clippy's
is_multiple_of, needless index loop and type complexity. input.rs: the
MOUSE_MOVE_ABS builder dropped the y field; the PROTOCOL.md cross-check would
have caught it at runtime.
2026-11-25 13:08:24 +01:00
mnovak 8d0bebfbc3 [domistream] Crypto: aes-gcm without default features
default-features = false, features = ["aes", "alloc"]: aes-gcm's default
pulls in getrandom, which would make the OS RNG reachable inside a crate whose
randomness must only come through RandomSource. Approved by the build lead.
Cargo.lock also gains the test-only dev-dependencies (proptest, peak_alloc).
2026-11-25 13:08:24 +01:00
mnovak b57e97a38b [domistream] Tests: fixtures from tools/vectors
Generated by tools/vectors/gen_vectors.py with Python hashlib, OpenSSL 3.5.7
(Git for Windows) and .NET 10 AesGcm. Keys and certificates are TEST-ONLY,
made fresh on this machine for these tests: RSA-2048 host, client and rogue
identities, and an EC certificate for the non-RSA refusal.
2026-11-25 13:08:24 +01:00
mnovak ab5404b0cf [repo] Lab capture: lab root on E:\build\play-remotely\lab (approved), build rule with TEMP/TMP on E: 2026-11-25 13:03:10 +01:00
mnovak da1f3afd52 [domistream] Tests: rustfmt 2026-11-25 12:52:38 +01:00
mnovak 948f446a13 [domistream] Tests: fuzz targets assert invariants
Every target now checks properties instead of only calling the parser:
parse -> encode -> parse stability (RTSP request, ENet, input), caps and
TooLarge past them, chunking invariance of the framer, XML vs status parser
agreement, seal/open round trips, no forged GCM tags. New targets for the
parsers and state machines that had none: server_cert_der, enet_client,
media_decrypt, video_depacketizer, audio_depacketizer, fec_reconstruct,
pairing_session, rtsp_client (25 targets).
2026-11-25 12:51:08 +01:00
mnovak 71e34e8d9d [domistream] Tests: allocation caps
A counting global allocator (peak_alloc) checks that small inputs with lying
length fields and arbitrary inputs never make a parser allocate past a bound
tied to the input and its caps; depacketizers and the ENet peer stay within
their in-flight caps.
2026-11-25 12:51:07 +01:00
mnovak 9c59b69bf0 [domistream] Tests: audio depacketizer with the parity-matrix hook
All 64 loss patterns of a 4+2 block with two different MDS matrices through
AudioFec::ParityMatrix (U16 unmeasured), encrypted and plain; FEC disabled;
sequence wrap; duplicates; reordering; far-past and far-future; hostile
parity; the loss timeout.
2026-11-25 12:51:06 +01:00
mnovak 240190041d [domistream] Tests: video depacketizer loss patterns
Generated multi-block frames with random, bursty, all-parity, all-data,
last-packet loss, reordering and duplicates; RTP sequence and frame index
wraps; far-past and far-future strays; recovered shard headers deliberately
garbage (bytes 0-31 untrusted); encryption with tampering. Frames are
byte-exact or reported in FrameLost, never corrupt.
2026-11-25 12:51:06 +01:00
mnovak f3ad3afe00 [domistream] Tests: Reed-Solomon erasure patterns
Every erasure pattern of size <= m for k 1..=8, m 1..=4 and the Wolf 4+2
example; k = 1..=255-m sweeps for m in 1,2,3,4,8,16,64,127,254; > m refused
with Truncated. with_parity_matrix checked byte-exact against an independent
GF(2^8) Cauchy construction and refused for non-MDS matrices.
2026-11-25 12:51:05 +01:00
mnovak ecc9908082 [domistream] Tests: media packet parsers and ciphers
RTP header, video packet and frame header, audio packet at every size
boundary; inconsistent FEC fields; video AES-GCM against .NET vectors and
audio AES-CBC against openssl vectors, including rikeyid + seq wrap and bad
padding. The RustCrypto test oracles are checked against the same vectors.
2026-11-25 12:51:04 +01:00
mnovak fbfcd588a5 [domistream] Tests: input vectors from the field tables
INPUT_DATA built from PROTOCOL.md 4 field tables, cross-checked against its
example bytes; encode, parse, equal for every known type; unknown types,
UNKNOWN-layout types, wrong lengths, lying length and size fields, changed
constants and out-of-range values refused.
2026-11-25 12:51:04 +01:00
mnovak fea864d16e [domistream] Tests: control frames, replay and messages
Nonce layout (seq LE, 6 zero, direction, 'C'), seal against .NET AesGcm
vectors, every tampered byte, wrong direction and key, lying length fields.
ControlStream drops replayed, older, reflected and forged frames and refuses
seq 0 after u32::MAX. Host message layouts and client message encoding.
2026-11-25 12:51:03 +01:00
mnovak 38a455a717 [domistream] Tests: ENet codec and client peer
Byte vectors built from the PROTOCOL.md 3.1 field definitions, every command
size, truncation, compressed and unknown commands, 32/33 commands and
4096/4097 bytes. Client: handshake, reliable sequence past 0xFFFF -> 0,
duplicates, far-future and far-past, lying fragments, retransmission,
timeout and disconnect.
2026-11-25 12:51:03 +01:00
mnovak e4ca1509c8 [domistream] Tests: RTSP parsers, framer, SDP and client
Bad start lines, header floods, line cap, lying Content-Length (over, under,
past the cap, past u64), 64 KiB+1 in the framer, chunking invariance,
surround-params against RFC 7845, ANNOUNCE intersection, and the client state
machine with hostile answers.
2026-11-25 12:51:03 +01:00
mnovak d0fe9a906c [domistream] Tests: pairing state machine against recorded vectors
Walks every state with a recorded transcript (fixtures from tools/vectors).
Wrong PIN, wrong hash, wrong cert, rogue and flipped signatures, wrong sizes,
out-of-order, replayed and cross-session answers all end in Failed(reason);
Paired cannot be reached by skipping a step. Crypto helpers, certificates,
identities and the PIN against the same vectors.
2026-11-25 12:51:01 +01:00
mnovak b261d7ddc9 [domistream] Tests: hostile HTTP and XML input
XML reader, serverinfo, applist, launch and status answers: empty, 1 byte,
max-1, max, max+1, huge; depth bombs, element, attribute and text caps,
entities, DTD and billion laughs, namespaces. Request builders refuse bad ids
and query injection. proptest round trip of generated XML trees.
2026-11-25 12:51:01 +01:00
mnovak 9d94b66975 [domistream] Tests: sans-I/O guard and secret hygiene
Fails if src/ uses std::net, Instant::now, SystemTime::now, std::thread,
std::fs, processes, env reads or OS randomness (comments stripped, grouped
std imports caught). Checks forbid(unsafe_code) and that Debug never prints
rikey, the PIN or the private key.
2026-11-25 12:51:00 +01:00
mnovak 7326767f37 [domistream] Tests: vector generator and shared test helpers
tools/vectors/gen_vectors.py makes the crypto vectors with tools independent of
RustCrypto: Python hashlib (SHA-256), the OpenSSL 3.5 CLI (RSA-2048 test-only
keys, X.509 certs, PKCS#1 v1.5 SHA-256 signatures, AES-128-ECB -nopad,
AES-128-CBC) and .NET 10 AesGcm (gcm_vectors.cs). Output goes to
crates/domistream/tests/fixtures (text only); not generated in this commit.

tests/common: seeded and scripted RandomSource, fixture reader, an independent
GF(2^8)/0x11D reference with Cauchy matrices, and test hosts that packetize
video (PROTOCOL.md 5.2-5.3) and audio (6.2-6.4).

Dev-dependencies: proptest (std only, no fork/timeout) and peak_alloc (MIT,
counting allocator for the allocation-cap test).
2026-11-25 12:51:00 +01:00
mnovak a2b834ed87 [repo] Lab relay: recorder, redacting dump, TCP/TLS-terminating/UDP relays, CLI (never compiled yet) 2026-11-25 12:36:56 +01:00
mnovak fbb8833f3d [repo] Lab capture: lab root back on F:\Akce\DomiStream-lab (move to E: cancelled) 2026-11-25 12:34:46 +01:00
mnovak 8b968be489 [repo] Lab capture: lab root moves to E:\build\play-remotely\lab (F: is full); build rule and TLS fallback noted 2026-11-25 12:32:11 +01:00
mnovak 26ce712e82 [repo] Lab relay: record file format, loopback-only config, streaming rewriter, with unit tests (not yet compiled) 2026-11-25 12:31:06 +01:00
mnovak 11c14b8cb6 [repo] Lab capture: plan for one Sunshine/Moonlight session through our loopback relay 2026-11-25 12:27:30 +01:00
mnovak 424cccfa92 [repo] Protocol: ENet timeout rule counts send attempts, not retries 2026-11-25 12:23:47 +01:00
mnovak 3bd7ebeaed [repo] Protocol: ENet 1.3 wire from stock ENet narrows U9; video FEC Cauchy matrix from fec-rs settles U14 2026-11-25 12:22:59 +01:00
mnovak af1df633a1 [repo] Clean room: stock ENet, tokio-enet and fec-rs approved (Mark, answer 15), binaries black-box only, new reads logged 2026-11-25 12:21:45 +01:00
mnovak 6370e0a4bc [repo] Fuzz: note that only the SanitizerCoverage build links on Windows 2026-11-25 12:01:19 +01:00
mnovak c83fce11e9 [repo] README: repository layout 2026-11-25 12:01:10 +01:00
mnovak 3ade60d0b4 [repo] Fuzz: one libFuzzer target per parser, own workspace, Windows MSVC setup from Via 2026-11-25 12:01:09 +01:00
mnovak 31d1fc3655 [domistream] Audio API: packet parser, CBC decryption, 4+2 FEC depacketizer 2026-11-25 11:48:04 +01:00
mnovak b4a21dfc10 [domistream] Video API: packet parser, frame header, decryption, depacketizer with FEC 2026-11-25 11:47:55 +01:00
mnovak e7c69ac956 [domistream] RTP and FEC API: RTP header parser, Reed-Solomon over GF(2^8) 2026-11-25 11:47:42 +01:00
mnovak c01f980292 [domistream] Control API: AES-GCM frame, control messages, control stream 2026-11-25 11:47:25 +01:00
mnovak 213f87b871 [domistream] Input API: mouse, keyboard and gamepad events with their INPUT_DATA codec 2026-11-25 11:46:55 +01:00
mnovak fc5b0b116c [domistream] ENet API: sans-I/O 1.3 datagram codec and client peer 2026-11-25 11:46:37 +01:00
mnovak 024fe14ca6 [domistream] RTSP API: message codec, stream framer, SDP, negotiation state machine 2026-11-25 11:46:10 +01:00
mnovak 736a8f42b0 [domistream] Pairing API: PIN handshake state machine, pure crypto steps, client identity, pinned host cert 2026-11-25 11:45:57 +01:00
mnovak 0188ffba97 [domistream] HTTP API: serverinfo, applist, launch/resume/cancel requests and capped XML parsers 2026-11-25 11:45:30 +01:00