forge
Explore
Log in

Don't you dare go Hollow

wiki: Document the security model

Browse files at this commit

83e839762fa208b3631163e85d760e0e89fe8fe3Ivan MolodetskikhParent: 4c1196f
docs/mkdocs.yamlmodified+1 -0
@@ -88,6 +88,7 @@ nav:
88 - Window Effects: Window-Effects.md88 - Window Effects: Window-Effects.md
89 - Packaging niri: Packaging-niri.md89 - Packaging niri: Packaging-niri.md
90 - Integrating niri: Integrating-niri.md90 - Integrating niri: Integrating-niri.md
91+ - Security Model: Security-Model.md
91 - Accessibility: Accessibility.md92 - Accessibility: Accessibility.md
92 - Name and Logo: Name-and-Logo.md93 - Name and Logo: Name-and-Logo.md
93 - FAQ: FAQ.md94 - FAQ: FAQ.md
docs/wiki/Integrating-niri.mdmodified+4 -0
@@ -63,3 +63,7 @@ Alternatively, some desktop environments and shells work with niri, and can give
63 - Many [XFCE](https://www.xfce.org/) components work on Wayland, including niri. See [their wiki](https://wiki.xfce.org/releng/wayland_roadmap#component_specific_status) for details.63 - Many [XFCE](https://www.xfce.org/) components work on Wayland, including niri. See [their wiki](https://wiki.xfce.org/releng/wayland_roadmap#component_specific_status) for details.
64 - There are complete desktop shells based on Quickshell that support niri, for example [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell) and [Noctalia](https://github.com/noctalia-dev/noctalia-shell).64 - There are complete desktop shells based on Quickshell that support niri, for example [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell) and [Noctalia](https://github.com/noctalia-dev/noctalia-shell).
65 - You can run a [COSMIC](https://system76.com/cosmic/) session with niri using [cosmic-ext-extra-sessions](https://github.com/Drakulix/cosmic-ext-extra-sessions).65 - You can run a [COSMIC](https://system76.com/cosmic/) session with niri using [cosmic-ext-extra-sessions](https://github.com/Drakulix/cosmic-ext-extra-sessions).
66+
67+### Security model
68+
69+See the [Security Model](./Security-Model.md) page for an overview of niri's security model.
docs/wiki/Security-Model.mdadded+45 -0
@@ -0,0 +1,45 @@
1+Niri assumes that programs running unsandboxed on the host are **trusted**.
2+
3+This is a reasonable assumption because programs running on the host have a wide variety of ways to get all access they need, even without niri.
4+For instance:
5+
6+- They can set `$LD_PRELOAD` in `.bashrc` or similar files to load an arbitrary library into all processes.
7+- They can replace binaries in `$PATH` with malicious code.
8+- They can interpose any socket in `$XDG_RUNTIME_DIR`, like Wayland, and do keylogging or record window contents.
9+- They can scan the filesystem for secrets: SSH keys, password stores, etc.
10+- They can connect to an unlocked keyring and steal credentials.
11+- And so on and so forth.
12+
13+## Unsandboxed clients
14+
15+Anything with access to niri's Wayland socket can, among other things:
16+
17+- Record the user's screen via [wlr-screencopy](https://wayland.app/protocols/wlr-screencopy-unstable-v1).
18+- Emulate input via [wlr-virtual-pointer](https://wayland.app/protocols/wlr-virtual-pointer-unstable-v1) and [virtual-keyboard](https://wayland.app/protocols/virtual-keyboard-unstable-v1).
19+- Get the user's clipboard contents via [wlr-data-control](https://wayland.app/protocols/ext-data-control-v1).
20+- Create arbitrary fullscreen surfaces through [wlr-layer-shell](https://wayland.app/protocols/wlr-layer-shell-unstable-v1) that can steal the user's input, pretend to be a password entry, or lock the user out of their session.
21+- Kill a running lockscreen, create a new lock surface, and tell niri to unlock a locked session.
22+
23+Anything with access to niri's [IPC](./IPC.md) socket can, among other things:
24+
25+- Spawn a Wayland client which can do everything in the list above.
26+
27+Anything with access to niri's D-Bus interfaces can, among other things:
28+
29+- Record the user's screen via the screencast interface.
30+- Fully listen to and emulate input from the user's keyboard via the accessibility interface.
31+
32+## Running untrusted clients
33+
34+Considering all of the above, for running untrusted clients, you need a proper sandbox that:
35+
36+- Removes niri's IPC socket.
37+- Prevents D-Bus access to host services.
38+- Uses a filtered Wayland socket.
39+
40+For creating a filtered Wayland socket, you can use the [security-context](https://wayland.app/protocols/security-context-v1) protocol which niri implements.
41+All unsafe protocols are made inaccessible through this filtered Wayland socket.
42+
43+One sandbox that satisfies all of these criteria is the [Flatpak](https://flatpak.org/) sandbox.
44+
45+Importantly, filtering just the Wayland socket (and leaving, for example, unrestricted D-Bus access) is **not enough** to prevent untrusted clients from doing bad things.
docs/wiki/_Sidebar.mdmodified+1 -0
@@ -17,6 +17,7 @@
17 * [Window Effects](./Window-Effects.md)17 * [Window Effects](./Window-Effects.md)
18 * [Packaging niri](./Packaging-niri.md)18 * [Packaging niri](./Packaging-niri.md)
19 * [Integrating niri](./Integrating-niri.md)19 * [Integrating niri](./Integrating-niri.md)
20+* [Security Model](./Security-Model.md)
20 * [Accessibility](./Accessibility.md)21 * [Accessibility](./Accessibility.md)
21 * [Name and Logo](./Name-and-Logo.md)22 * [Name and Logo](./Name-and-Logo.md)
22 * [FAQ](./FAQ.md)23 * [FAQ](./FAQ.md)