Template tests / tests (pull_request) Failing after 33s
Phase 3 of the improvement plan (PR 10 of the sequence): honest Wayland behavior and a least-privilege alternative to the broad `input` group the audit flagged as a keylogging surface. Least-privilege input access: - packaging/linux/common/60-stepforge-input.rules grants the ACTIVE session read access to MOUSE devices only (ID_INPUT_MOUSE, excluding ID_INPUT_KEYBOARD) via a systemd uaccess ACL — session-scoped, device- scoped, and never keyboards. This replaces `usermod -aG input`, which grants every input device (keyboards included) to the user permanently. - scripts/linux/enable-click-capture.sh installs it opt-in: it prints the exact rule, requires confirmation, and documents the security tradeoff. It never runs the broad-group command. Honest trigger reporting: - New chooseCaptureTrigger() (app/platform/linux/diagnostics.js, re-exported from app/platform/index.js) maps a capability profile to the real trigger: per-click with a marker on X11+xinput; per-click WITHOUT coordinates or a marker on Wayland evdev (the platform exposes no pointer position); and an honest hotkey/interval fallback otherwise. It never promises per-click capture with coordinates on Wayland. - platform:capabilities now includes the active trigger for the machine and the user's fallback setting, for the diagnostics UI. Docs: - GETTING_STARTED_WITH_LINUX.md no longer instructs every Wayland user to join the `input` group; it presents that as a warning, documents the least- privilege script, corrects the capability table (per-click is opt-in, mice only; hotkey/interval is the default Wayland trigger), and points at Settings → Diagnostics. Tests: trigger decisions for X11/xinput, Wayland evdev (no coordinates/marker), Wayland fallback (interval/hotkey with an honest note), the platform facade wiring, Windows; the udev rule (mouse-only, excludes keyboards, uaccess); the opt-in enable script (confirms, installs the rule, never runs usermod -aG input as a command); and docs guards. 289 unit tests pass; startup smoke and click self-test unchanged (stream, markers 3/3, burst 8/8). Co-Authored-By: Claude Fable 5 <[email protected]>
53 lines
1.8 KiB
Bash
Executable File
53 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# OPTIONAL: enable per-click capture on Wayland (or X11 without xinput) using a
|
|
# LEAST-PRIVILEGE udev rule instead of the broad `input` group.
|
|
#
|
|
# Security tradeoff (read before running):
|
|
# * This grants your ACTIVE local session read access to MOUSE devices only.
|
|
# * It deliberately EXCLUDES keyboards — StepForge never needs keystrokes.
|
|
# * Access is session-scoped (systemd `uaccess` ACL), not a permanent group.
|
|
# * It is NOT required: the safe default is a global hotkey or interval
|
|
# capture. Only enable this if you want a screenshot on every click.
|
|
#
|
|
# Compare to `sudo usermod -aG input "$USER"`, which grants access to ALL input
|
|
# devices (including keyboards) for your user on every session — a much larger
|
|
# surface. This script does not do that.
|
|
set -euo pipefail
|
|
|
|
RULE_SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)/packaging/linux/common/60-stepforge-input.rules"
|
|
RULE_DEST="/etc/udev/rules.d/60-stepforge-input.rules"
|
|
|
|
if [ ! -f "$RULE_SRC" ]; then
|
|
echo "error: rule file not found at $RULE_SRC" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "This installs a least-privilege udev rule granting your session read"
|
|
echo "access to MOUSE devices only (never keyboards):"
|
|
echo
|
|
sed 's/^/ /' "$RULE_SRC"
|
|
echo
|
|
printf 'Install it to %s? [y/N] ' "$RULE_DEST"
|
|
read -r reply
|
|
case "$reply" in
|
|
y|Y|yes|YES) ;;
|
|
*) echo "Aborted. No changes made."; exit 0 ;;
|
|
esac
|
|
|
|
SUDO=""
|
|
if [ "$(id -u)" -ne 0 ]; then SUDO="sudo"; fi
|
|
|
|
$SUDO install -m 0644 "$RULE_SRC" "$RULE_DEST"
|
|
$SUDO udevadm control --reload-rules
|
|
$SUDO udevadm trigger --subsystem-match=input --action=change || true
|
|
|
|
cat <<'MSG'
|
|
|
|
Installed. You may need to unplug/replug a USB mouse or re-log in for the ACL
|
|
to apply to already-connected devices.
|
|
|
|
To remove it later:
|
|
sudo rm /etc/udev/rules.d/60-stepforge-input.rules
|
|
sudo udevadm control --reload-rules
|
|
MSG
|