host/observer: close the snd_aloop absent-driver leak (Codex re-review)

Codex's re-review of the phase-3 fixes confirmed finding 1/5/6 closed but
found the finding-2 fix incomplete: the denylist only rejected a *present*
snd_aloop driver, so an snd_aloop node whose alsa.driver_name was not copied
onto the node still classified session_device=true — the original leak. The
absence is reachable: PipeWire >=1.2.6 stopped overwriting node props with
card props, and WirePlumber only began copying alsa.* onto nodes in 0.5.13.

Fix: session_device now requires a PRESENT, non-denied ALSA driver; a missing
alsa.driver_name fails closed to NotSessionDevice (a real card without the
prop is over-excluded — safe; recovering it needs reading the driver from the
backing Device global, owed to a later round). Mutation-verified: reverting to
fail-open on absence is killed by classify_alsa_without_driver_name_fails_closed.

Also: corrected the finding-3 limitation doc to cite PipeWire's object.serial
identity contract rather than overclaiming the live gate proves it (Codex P3,
non-blocking).

121 unit + live gate row 6 green, clippy clean, observer files fmt-clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 13:40:47 -04:00
co-authored by Claude Opus 4.8
parent 557c1030a7
commit f90bee63f7
3 changed files with 49 additions and 13 deletions
+20
View File
@@ -142,6 +142,26 @@ fn classify_invented_bluez_factories_are_not_session_devices() {
}
}
#[test]
fn classify_alsa_without_driver_name_fails_closed() {
// Codex re-review: a missing `alsa.driver_name` must NOT grant
// session_device — an snd_aloop node whose driver prop was not copied onto
// the node would otherwise slip through. Absence fails closed.
for factory in ["api.alsa.pcm.sink", "api.alsa.pcm.source"] {
let claim = DeviceClaim {
device_id: Some(gid(7)),
device_api: Some("alsa".to_string()),
factory_name: Some(factory.to_string()),
alsa_driver_name: None,
};
assert_eq!(
classify(&claim, true),
Classification::NotSessionDevice,
"absent driver on {factory} must fail closed"
);
}
}
#[test]
fn classify_snd_aloop_is_not_a_session_device() {
// Finding 2: an ALSA loopback presents with an allowlisted factory and