Search existing issues
Problem Description
In the Linux installation and platform documentation (Mouse clicks on Wayland), OpenScreen notes that distinguishing mouse clicks from movement on Wayland requires reading /dev/input/event*, and suggests:
sudo usermod -aG input $USER
While the documentation already includes a very fair caution about this, adding a desktop user account to the input group presents a substantial security hazard:
- Ambient Keylogger Authority: The
input group applies to all /dev/input/event* devices, including physical and virtual keyboards.
- Once added to
input, every unprivileged process running under that user (web browsers, build tools, npm/pip/cargo packages, IDE extensions) gains permission to open raw keyboard event streams in the background and record every keystroke (passwords, tokens, SSH keys, private chats).
Proposed Solution
On systemd-based Linux distributions, a safer and cleaner alternative is to deploy a targeted udev rule with TAG+="uaccess":
KERNEL=="event*", SUBSYSTEM=="input", ENV{ID_INPUT_MOUSE}=="1", ENV{ID_INPUT_KEYBOARD}!="1", TAG+="uaccess"
(e.g. placed in /etc/udev/rules.d/70-openscreen-mouse.rules, or deployed declaratively in NixOS / distro packages).
How This Works
- Dynamic Seat ACLs: When a mouse device is plugged in or detected, udev attaches
TAG+="uaccess". systemd-logind automatically assigns dynamic read/write POSIX ACLs (setfacl) on that specific device node exclusively to the active desktop session user.
- Hardware Keyboard Exclusion: Keyboards are strictly excluded (
ENV{ID_INPUT_KEYBOARD}!="1"). Even if userspace is compromised, the kernel refuses to open keyboard character devices.
- No Group Membership: The user never needs to join the
input group, and there is no need to log out and log back in for changes to take effect.
- No Privileged Binaries: Avoids needing SUID/SGID binaries on disk.
Threat Profile Comparison
| Capability |
Default Wayland |
With Mouse udev uaccess (Proposed) |
With Scoped setgid Binary |
With sudo usermod -aG input |
| Keystrokes / Passwords |
🔒 Blocked |
🔒 Blocked |
⚠️ Exposes attack surface (helper has group input) |
🚨 Exposed to all user apps |
| Global Mouse Clicks |
🔒 Blocked |
⚠️ Readable by user apps |
🔒 Blocked (only helper reads it) |
⚠️ Readable by user apps |
| Relative Mouse Motion |
🔒 Blocked |
⚠️ Readable by user apps |
🔒 Blocked (only helper reads it) |
⚠️ Readable by user apps |
| Synthetic Click Injection |
🔒 Blocked |
🔒 Blocked |
🔒 Blocked |
🔒 Blocked |
| Device Grab / Freeze |
🔒 Blocked |
⚠️ Possible via ioctl |
🔒 Blocked |
⚠️ Possible via ioctl |
Additional Context & References
We have documented and verified this approach in our own setups:
@EtienneLescot — would a docs-only PR updating website/docs/installation.md to explain and recommend this udev approach be a welcome contribution?
@Renna42 as something could potentially include in a future updated nixpgks (IFF there is interest)
Search existing issues
Problem Description
In the Linux installation and platform documentation (Mouse clicks on Wayland), OpenScreen notes that distinguishing mouse clicks from movement on Wayland requires reading
/dev/input/event*, and suggests:sudo usermod -aG input $USERWhile the documentation already includes a very fair caution about this, adding a desktop user account to the
inputgroup presents a substantial security hazard:inputgroup applies to all/dev/input/event*devices, including physical and virtual keyboards.input, every unprivileged process running under that user (web browsers, build tools, npm/pip/cargo packages, IDE extensions) gains permission to open raw keyboard event streams in the background and record every keystroke (passwords, tokens, SSH keys, private chats).Proposed Solution
On systemd-based Linux distributions, a safer and cleaner alternative is to deploy a targeted udev rule with
TAG+="uaccess":(e.g. placed in
/etc/udev/rules.d/70-openscreen-mouse.rules, or deployed declaratively in NixOS / distro packages).How This Works
TAG+="uaccess".systemd-logindautomatically assigns dynamic read/write POSIX ACLs (setfacl) on that specific device node exclusively to the active desktop session user.ENV{ID_INPUT_KEYBOARD}!="1"). Even if userspace is compromised, the kernel refuses to open keyboard character devices.inputgroup, and there is no need to log out and log back in for changes to take effect.Threat Profile Comparison
uaccess(Proposed)sudo usermod -aG inputinput)ioctlioctlAdditional Context & References
We have documented and verified this approach in our own setups:
@EtienneLescot — would a docs-only PR updating
website/docs/installation.mdto explain and recommend this udev approach be a welcome contribution?@Renna42 as something could potentially include in a future updated
nixpgks(IFF there is interest)