Acts on the 2026-08-05 host security review. 36 of its 38 findings; the two exceptions are recorded below and in the review doc. The review's headline is that `plugin_may_access` was the one authorization gate in the system that was allow-by-default — a hand-maintained denylist of route prefixes, where every sibling gate is deny-by-default. Its own doc comment names the two capabilities it exists to withhold, and both were reachable one route over, because ~1450 commits of new routes were added and the list was never one of the things anyone remembered to update. So the gate is now an allowlist, and a test walks the live route table and fails the build for any route that has not been deliberately classified for both non-admin lanes. That test is the actual fix: it is what stops the next route from arriving pre-authorized. Route reachability and field authority turned out to be different questions. A provider plugin has to be able to reconcile its own library entries — that is what a scanner plugin IS — but `prep` and a `command` launch inside that payload are handed to `/bin/sh -c` as the host user, and every execution site documents them as operator-typed. Requests now carry the lane that authorized them, and those two fields are refused to everyone but the operator's own token. The art proxy read any absolute path off disk in the host process, which on Windows is LocalSystem, from a path the plugin lane could write and then read back — so it yielded `mgmt-token`, which is full admin. It now serves only real images (extension AND magic bytes, so a renamed secret fails), only from inside an allowed root, only after canonicalization, and never over UNC; and a path it would refuse to serve can no longer be persisted in the first place. On Windows, the config-dir hardening was skipped exactly when it was needed — it ran only in the branch that CREATES host.env, so the case it was written for (a local user pre-created the directory and planted one) was the one case it never ran in. It is now unconditional and first, an existing host.env is re-owned, and the inheritable OWNER RIGHTS ACE that kept an attacker's files theirs after the directory was re-owned is gone. The identity and token readers were hardening the directory only on the path that GENERATED a new secret, so a planted cert/key or token was adopted verbatim and permanently; they harden before the first read now. `ensure_admin_only_source` is implemented. The 2026-07-05 audit recorded it as FIXED and it was in no commit in this repository's history — the local EoP it described was live, and it is the payload half of the config-dir chain above. Also: the three input planes are bounded and lossy like the mic plane on the same loop already was; Android's library client no longer accepts any publicly-trusted certificate for the pinned host; the usbip vhci nodes get their own group instead of riding on `input`, which every packaging scriptlet tells users to join; a registry URL can no longer inject a TOML table into bunfig.toml; the pairing cooldown is charged before the arming state is read, so armed/disarmed is no longer a free oracle; and the whole Low tier, of which the two worth naming are a clipboard MIME NUL that panicked the host on one control message, and an unauthenticated global logout that let any LAN peer sign the operator out on a loop. NOT fixed, deliberately: H-3 (plugin UIs framed allow-same-origin). Dropping allow-same-origin does not work: the document's origin goes opaque, its subresource requests are then cross-site, the SameSite=Lax session cookie is not sent, and every plugin asset 302s to /login. The "open in new tab" link is the same escalation with no iframe at all, so the sandbox attribute is not where this gets fixed either. It needs a second listener — a distinct origin that is still the same site — which changes the console's deploy model and wants on-glass validation. The mechanism and the dead end are written down at the iframe. H-6 registry authentication, whose other half lives in unom/infra. The in-repo halves are done: workflow_dispatch inputs no longer interpolate into run: blocks (one of them in the step holding UPDATE_MANIFEST_KEY), and the syft installer is pinned to its tag instead of main. Digest pinning is left until the registry is authenticated, because a tag — content-keyed or not — can simply be overwritten while anonymous pushes are accepted. M-5 is half done: the oracle is closed, but binding the arming window needs the console to learn the fingerprint first, which is a knock-then-bind flow rather than an edit. Verified: cargo fmt --all --check clean; cargo check --all-targets green on Linux and on Windows (confirmed non-vacuous — a planted type error in windows/install.rs fails the build); scripts/xcheck.sh windows check green; cargo test -p punktfunk-host --bins 416 passed, the single failure being gamestream::stream::tests::sender_delivers_batches, the known qemu-environmental UDP-loopback flake that fails identically on clean main in the same container; cargo test -p pf-clipboard 13 passed; web console typechecks.
51 lines
3.9 KiB
Plaintext
51 lines
3.9 KiB
Plaintext
# udev rules for the punktfunk streaming host (mirrors Sunshine's 60-sunshine.rules).
|
|
#
|
|
# Grants the `input` group access to /dev/uinput (virtual X-Box-360 gamepads) and /dev/uhid
|
|
# (virtual DualSense via the kernel hid-playstation driver — LED, adaptive triggers, touchpad,
|
|
# gyro). `static_node` makes the nodes exist before their modules load.
|
|
#
|
|
# Install:
|
|
# sudo cp scripts/60-punktfunk.rules /etc/udev/rules.d/
|
|
# sudo usermod -aG input $USER # then re-login (or reboot)
|
|
# sudo udevadm control --reload-rules && sudo udevadm trigger
|
|
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
KERNEL=="uhid", SUBSYSTEM=="misc", OPTIONS+="static_node=uhid", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
|
|
# usbip vhci attach/detach for the virtual Steam Deck controller. Steam Input only
|
|
# adopts the virtual Deck when it arrives as a USB device (usbip/vhci or raw_gadget);
|
|
# the UHID fallback has no USB interface and Steam ignores it. The sysfs attach files
|
|
# are root-only by default while the host runs as a user service — grant the dedicated
|
|
# `punktfunk` group write when vhci_hcd appears (module autoload: modules-load.d/punktfunk.conf).
|
|
#
|
|
# ⚠ This is deliberately NOT the `input` group (2026-08-05 review M-4). Writing `attach` hands the
|
|
# kernel a caller-supplied socket fd and materialises an arbitrary, fully userspace-emulated USB
|
|
# device — a root-only kernel primitive. Every packaging scriptlet tells the user to
|
|
# `usermod -aG input $USER` as step 1, so putting it on `input` handed that primitive to a group
|
|
# people are routinely told to join: a member could present a HID keyboard and inject keystrokes
|
|
# into a root TTY or the lock screen, or drive any of hundreds of in-tree USB drivers from
|
|
# userspace, all without CAP_SYS_ADMIN. The uinput/uhid grants above are already systemwide input
|
|
# injection, but neither reaches kernel USB enumeration — this one does, so it gets its own group
|
|
# that nothing else asks users to join.
|
|
ACTION=="add", SUBSYSTEM=="platform", KERNEL=="vhci_hcd.*", RUN+="/bin/sh -c 'chgrp punktfunk /sys%p/attach /sys%p/detach && chmod 0660 /sys%p/attach /sys%p/detach'"
|
|
|
|
# hidraw access for the VIRTUAL pads this host creates. Steam/SDL drive a DualSense's rich
|
|
# feedback (adaptive triggers, lightbar, player LEDs) exclusively over hidraw — the kernel has no
|
|
# evdev API for any of it — and Steam without hidraw demotes a PlayStation pad to a generic evdev
|
|
# device, losing its rumble handling too. hidraw nodes are root-only by default; the distro's
|
|
# steam-devices rules + logind's uaccess ACL cover only the active seat session, so a game
|
|
# launched outside it (a headless/dedicated streaming session) is silently feedback-dead.
|
|
# GROUP="input" makes access follow the same group the host itself already requires.
|
|
# KERNELS matches the HID device name (works for UHID devices, which have no USB parent);
|
|
# the ATTRS pair covers the usbip/gadget Deck, which IS a (virtual) USB device.
|
|
# DualSense (054C:0CE6) / DualSense Edge (054C:0DF2) / DualShock 4 (054C:09CC)
|
|
KERNEL=="hidraw*", KERNELS=="*054C:0CE6*", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
KERNEL=="hidraw*", KERNELS=="*054C:0DF2*", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
KERNEL=="hidraw*", KERNELS=="*054C:09CC*", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
# Switch Pro Controller (057E:2009) — SDL's hidapi driver wants hidraw for rumble/LEDs too
|
|
KERNEL=="hidraw*", KERNELS=="*057E:2009*", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
# Steam Deck (28DE:1205) / classic Steam Controller (28DE:1102), UHID and usbip/gadget forms
|
|
KERNEL=="hidraw*", KERNELS=="*28DE:1205*", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
KERNEL=="hidraw*", KERNELS=="*28DE:1102*", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
KERNEL=="hidraw*", ATTRS{idVendor}=="28de", ATTRS{idProduct}=="1205", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
KERNEL=="hidraw*", ATTRS{idVendor}=="28de", ATTRS{idProduct}=="1102", GROUP="input", MODE="0660", TAG+="uaccess"
|