appjail 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of appjail might be problematic. Click here for more details.
- {appjail-0.3.2 → appjail-0.3.4}/PKG-INFO +10 -4
- {appjail-0.3.2 → appjail-0.3.4}/README.md +9 -3
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cli.py +1 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_desktop.py +44 -7
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/desktop.py +20 -6
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/grants.py +7 -2
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/app.py +20 -7
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/apps.py +18 -1
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/argv.py +3 -1
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/dialogs.py +37 -5
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/indexstore.py +3 -1
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/jail.py +1 -2
- appjail-0.3.4/src/appjail/linger.py +81 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/manifest.py +4 -2
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/permargs.py +1 -1
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/runtimejail.py +3 -1
- {appjail-0.3.2 → appjail-0.3.4}/.gitignore +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/LICENSES/MPL-2.0.txt +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/REUSE.toml +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/pyproject.toml +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/__init__.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/__main__.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/appimage.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/attest.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/catalog.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_add.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_addimage.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_apps.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_index.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_open.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_portals.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_update.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/cmd_updateimage.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/console.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/dbusproxy.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/fetcher.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/github.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/__init__.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/__main__.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/appjail.svg +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/console.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/gui/worker.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/history.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/imagesrc.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/index.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/landlock.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/portal.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/runner.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/seccomp.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/services.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/snappy.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/store.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/textsafe.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/tools.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/updater.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/valid.py +0 -0
- {appjail-0.3.2 → appjail-0.3.4}/src/appjail/wayland.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: appjail
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Sandboxed AppImage manager built on bubblewrap
|
|
5
5
|
License-Expression: MPL-2.0
|
|
6
6
|
License-File: LICENSES/MPL-2.0.txt
|
|
@@ -63,6 +63,9 @@ is built around the opposite assumptions:
|
|
|
63
63
|
- `xdg-dbus-proxy`: D-Bus filtering and portals.
|
|
64
64
|
- `xwayland`: X11-only apps.
|
|
65
65
|
- `git`: the manifest history.
|
|
66
|
+
- `librsvg2-bin` (`rsvg-convert`): the menu icon of an app that ships only an SVG; without it the entry has no icon
|
|
67
|
+
(`appjail desktop APP --show` says so). `libgtk-3-bin` (`gtk-update-icon-cache`) makes new icons appear in the
|
|
68
|
+
menu at once; `desktop-file-utils` registers the file types.
|
|
66
69
|
- Linux 6.12 or later with Landlock (both supported systems have it): apps with `network_host`, which are
|
|
67
70
|
refused without it.
|
|
68
71
|
- A Pulse server (`pipewire-pulse` on PipeWire systems, or PulseAudio): audio. PipeWire's own socket is never used.
|
|
@@ -72,7 +75,7 @@ is built around the opposite assumptions:
|
|
|
72
75
|
On Debian or Ubuntu:
|
|
73
76
|
|
|
74
77
|
```sh
|
|
75
|
-
sudo apt install bubblewrap squashfs-tools passt xdg-dbus-proxy xwayland git
|
|
78
|
+
sudo apt install bubblewrap squashfs-tools passt xdg-dbus-proxy xwayland git librsvg2-bin libgtk-3-bin desktop-file-utils
|
|
76
79
|
```
|
|
77
80
|
|
|
78
81
|
## Install
|
|
@@ -180,7 +183,8 @@ appjail portals lagrange --revoke-all # take those grants bac
|
|
|
180
183
|
| `audio`, `gpu` | On by default; `--no-audio` and `--no-gpu` at `add` time, or `--deny` later. Audio (the Pulse socket) includes the microphone. |
|
|
181
184
|
| `portals` | The safe set of desktop portals; privileged ones are listed per app with `--add-portal`. |
|
|
182
185
|
| `userns` | Nested user namespaces (Chromium and Electron sandboxes). Weakens isolation, off by default. |
|
|
183
|
-
| `
|
|
186
|
+
| `linger` | Keep the jail until every process in it has exited, not only the one that was started. For apps whose launcher starts the real app detached and exits (VSCodium). Grants nothing; off by default. |
|
|
187
|
+
| `dirs` | Directories mapped into the private home (`--dir` / `--add-dir`). Credentials, browser profiles, shell startup files, system trees, `/tmp` and `/var/tmp` (other programs' sockets live there) are refused, and so is write access where code would run outside the jail later (`~/.local/bin`, `~/.local/lib`, autostart, icon themes, thumbnailers, file-manager scripts, ...). |
|
|
184
188
|
| `dbus_filter`, `dbus_own` | Session-bus names the app may talk to (`--dbus`) or own (`--dbus-own`), through `xdg-dbus-proxy`. Desktop namespaces are refused. |
|
|
185
189
|
| `display` | `wayland` (default) or `xwayland`. |
|
|
186
190
|
|
|
@@ -200,7 +204,8 @@ abstract unix sockets created outside the sandbox. The extracted app tree is has
|
|
|
200
204
|
app through appjail. appjail generates it itself; the AppImage's own `.desktop` is never used. File types are opt-in:
|
|
201
205
|
only the ones you pick show under "Open with", and appjail never makes the app a default. Opening a file passes just
|
|
202
206
|
that file to the app, read-only unless `--rw` (`appjail open NAME -- FILE...`). `desktop --remove` and `--prune` delete
|
|
203
|
-
entries; `remove` does it too.
|
|
207
|
+
entries; `remove` does it too. `desktop NAME --show` lists the registered file types, the ones the app offers and the ones
|
|
208
|
+
appjail refuses, and writes nothing (the Apps tab of the GUI has a "File types" button and a type list in "Menu entry…").
|
|
204
209
|
|
|
205
210
|
## Trust and updates
|
|
206
211
|
|
|
@@ -335,6 +340,7 @@ owner change.
|
|
|
335
340
|
| Message or symptom | Cause and fix |
|
|
336
341
|
|---|---|
|
|
337
342
|
| bwrap fails with `Operation not permitted` or `setting up uid map: Permission denied` | Unprivileged user namespaces are blocked. On Ubuntu, AppArmor can restrict them (`kernel.apparmor_restrict_unprivileged_userns`); the project's CI relaxes it with `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`. That changes a system-wide protection, so decide for yourself whether to do it, or give bubblewrap its own AppArmor profile. |
|
|
343
|
+
| An app exits after a few seconds with code 0 and no window | Its launcher starts the real app detached and exits, and the jail ends with it (VSCodium does this). `appjail perms APP --allow linger` keeps the jail until every process in it has exited; or pass the app's own wait option, e.g. `appjail run vscodium -- --wait`. |
|
|
338
344
|
| `no usable Wayland session` or `Wayland socket not found` | `run` needs a Wayland compositor and `WAYLAND_DISPLAY`/`XDG_RUNTIME_DIR` in the environment (not available over a plain ssh login). Apps that only speak X11 use `perms APP --display xwayland` (needs `xwayland`). |
|
|
339
345
|
| An app with `network` is refused, naming `passt` | Install `passt`; the app is never put on the host network silently. |
|
|
340
346
|
| An app with `network_host` is refused, naming Landlock | The kernel lacks Landlock ABI 6 (Linux 6.12 or later, with Landlock enabled). Use `network` instead, which keeps the app in a private network namespace. |
|
|
@@ -48,6 +48,9 @@ is built around the opposite assumptions:
|
|
|
48
48
|
- `xdg-dbus-proxy`: D-Bus filtering and portals.
|
|
49
49
|
- `xwayland`: X11-only apps.
|
|
50
50
|
- `git`: the manifest history.
|
|
51
|
+
- `librsvg2-bin` (`rsvg-convert`): the menu icon of an app that ships only an SVG; without it the entry has no icon
|
|
52
|
+
(`appjail desktop APP --show` says so). `libgtk-3-bin` (`gtk-update-icon-cache`) makes new icons appear in the
|
|
53
|
+
menu at once; `desktop-file-utils` registers the file types.
|
|
51
54
|
- Linux 6.12 or later with Landlock (both supported systems have it): apps with `network_host`, which are
|
|
52
55
|
refused without it.
|
|
53
56
|
- A Pulse server (`pipewire-pulse` on PipeWire systems, or PulseAudio): audio. PipeWire's own socket is never used.
|
|
@@ -57,7 +60,7 @@ is built around the opposite assumptions:
|
|
|
57
60
|
On Debian or Ubuntu:
|
|
58
61
|
|
|
59
62
|
```sh
|
|
60
|
-
sudo apt install bubblewrap squashfs-tools passt xdg-dbus-proxy xwayland git
|
|
63
|
+
sudo apt install bubblewrap squashfs-tools passt xdg-dbus-proxy xwayland git librsvg2-bin libgtk-3-bin desktop-file-utils
|
|
61
64
|
```
|
|
62
65
|
|
|
63
66
|
## Install
|
|
@@ -165,7 +168,8 @@ appjail portals lagrange --revoke-all # take those grants bac
|
|
|
165
168
|
| `audio`, `gpu` | On by default; `--no-audio` and `--no-gpu` at `add` time, or `--deny` later. Audio (the Pulse socket) includes the microphone. |
|
|
166
169
|
| `portals` | The safe set of desktop portals; privileged ones are listed per app with `--add-portal`. |
|
|
167
170
|
| `userns` | Nested user namespaces (Chromium and Electron sandboxes). Weakens isolation, off by default. |
|
|
168
|
-
| `
|
|
171
|
+
| `linger` | Keep the jail until every process in it has exited, not only the one that was started. For apps whose launcher starts the real app detached and exits (VSCodium). Grants nothing; off by default. |
|
|
172
|
+
| `dirs` | Directories mapped into the private home (`--dir` / `--add-dir`). Credentials, browser profiles, shell startup files, system trees, `/tmp` and `/var/tmp` (other programs' sockets live there) are refused, and so is write access where code would run outside the jail later (`~/.local/bin`, `~/.local/lib`, autostart, icon themes, thumbnailers, file-manager scripts, ...). |
|
|
169
173
|
| `dbus_filter`, `dbus_own` | Session-bus names the app may talk to (`--dbus`) or own (`--dbus-own`), through `xdg-dbus-proxy`. Desktop namespaces are refused. |
|
|
170
174
|
| `display` | `wayland` (default) or `xwayland`. |
|
|
171
175
|
|
|
@@ -185,7 +189,8 @@ abstract unix sockets created outside the sandbox. The extracted app tree is has
|
|
|
185
189
|
app through appjail. appjail generates it itself; the AppImage's own `.desktop` is never used. File types are opt-in:
|
|
186
190
|
only the ones you pick show under "Open with", and appjail never makes the app a default. Opening a file passes just
|
|
187
191
|
that file to the app, read-only unless `--rw` (`appjail open NAME -- FILE...`). `desktop --remove` and `--prune` delete
|
|
188
|
-
entries; `remove` does it too.
|
|
192
|
+
entries; `remove` does it too. `desktop NAME --show` lists the registered file types, the ones the app offers and the ones
|
|
193
|
+
appjail refuses, and writes nothing (the Apps tab of the GUI has a "File types" button and a type list in "Menu entry…").
|
|
189
194
|
|
|
190
195
|
## Trust and updates
|
|
191
196
|
|
|
@@ -320,6 +325,7 @@ owner change.
|
|
|
320
325
|
| Message or symptom | Cause and fix |
|
|
321
326
|
|---|---|
|
|
322
327
|
| bwrap fails with `Operation not permitted` or `setting up uid map: Permission denied` | Unprivileged user namespaces are blocked. On Ubuntu, AppArmor can restrict them (`kernel.apparmor_restrict_unprivileged_userns`); the project's CI relaxes it with `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`. That changes a system-wide protection, so decide for yourself whether to do it, or give bubblewrap its own AppArmor profile. |
|
|
328
|
+
| An app exits after a few seconds with code 0 and no window | Its launcher starts the real app detached and exits, and the jail ends with it (VSCodium does this). `appjail perms APP --allow linger` keeps the jail until every process in it has exited; or pass the app's own wait option, e.g. `appjail run vscodium -- --wait`. |
|
|
323
329
|
| `no usable Wayland session` or `Wayland socket not found` | `run` needs a Wayland compositor and `WAYLAND_DISPLAY`/`XDG_RUNTIME_DIR` in the environment (not available over a plain ssh login). Apps that only speak X11 use `perms APP --display xwayland` (needs `xwayland`). |
|
|
324
330
|
| An app with `network` is refused, naming `passt` | Install `passt`; the app is never put on the host network silently. |
|
|
325
331
|
| An app with `network_host` is refused, naming Landlock | The kernel lacks Landlock ABI 6 (Linux 6.12 or later, with Landlock enabled). Use `network` instead, which keeps the app in a private network namespace. |
|
|
@@ -118,6 +118,7 @@ def build_parser():
|
|
|
118
118
|
dsk.add_argument("--mime-all", action="store_true", help="offer every file type the app declares (minus refused ones)")
|
|
119
119
|
dsk.add_argument("--rw", action="store_true", help="opened files are writable (default: read-only)")
|
|
120
120
|
dsk.add_argument("--remove", action="store_true", help="delete the app's menu entry and icons")
|
|
121
|
+
dsk.add_argument("--show", action="store_true", help="only show the file types registered, offered by the app and refused (writes nothing)")
|
|
121
122
|
dsk.add_argument("--prune", action="store_true", help="delete the entries of apps that no longer exist")
|
|
122
123
|
dsk.add_argument("--yes", action="store_true", help="do not ask (registers no file types unless --mime/--mime-all)")
|
|
123
124
|
opn = sub.add_parser("open", help="open files with an app, each bound alone into its jail (used by the menu entry)")
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
"""`appjail desktop`: the menu entry of an app, and the hooks `add`, `update` and `remove` call."""
|
|
5
5
|
|
|
6
|
+
import shutil
|
|
7
|
+
|
|
6
8
|
from . import desktop, manifest, store
|
|
7
9
|
from .console import Abort
|
|
8
10
|
|
|
@@ -16,6 +18,31 @@ def _check(name):
|
|
|
16
18
|
raise Abort(f"'{name}' has no extracted tree; run it once (`appjail run {name}`) and retry")
|
|
17
19
|
|
|
18
20
|
|
|
21
|
+
def file_type_state(name, fields=None):
|
|
22
|
+
"""(offered, ignored, registered, rw, has_entry) of an app: what it declares and passes the filter, what it declares
|
|
23
|
+
and does not, and what its installed entry registers (empty, read-only, when there is no entry). `fields`: the app's
|
|
24
|
+
own .desktop fields when the caller has read them already."""
|
|
25
|
+
fields = desktop.read_app_desktop(store.root_path(name)) if fields is None else fields
|
|
26
|
+
offered, ignored = desktop.split_mimes(fields.get("MimeType"))
|
|
27
|
+
state = desktop.installed_state(name)
|
|
28
|
+
return offered, ignored, (state[0] if state else []), bool(state and state[1]), state is not None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def show_file_types(name, console):
|
|
32
|
+
_check(name)
|
|
33
|
+
offered, ignored, registered, rw, has_entry = file_type_state(name)
|
|
34
|
+
if not has_entry:
|
|
35
|
+
console.out(f"{name} has no menu entry.")
|
|
36
|
+
else:
|
|
37
|
+
console.out("Icon : " + desktop.icon_status(name, store.root_path(name)))
|
|
38
|
+
mode = "read-write" if rw else "read-only"
|
|
39
|
+
console.out("Registered : " + (f"{', '.join(registered)} ({mode})" if registered else "none (launcher only)"))
|
|
40
|
+
console.out("Offered : " + (", ".join(m + (" *" if m in registered else "") for m in offered) or "none"))
|
|
41
|
+
if registered and offered:
|
|
42
|
+
console.out(" (* = registered)")
|
|
43
|
+
console.out("Not offered: " + (", ".join(ignored) or "none"))
|
|
44
|
+
|
|
45
|
+
|
|
19
46
|
def _select(console, declared, args, current, yes):
|
|
20
47
|
"""The MIME types to register: --mime-all, --mime TYPE, the current selection on a refresh, else ask."""
|
|
21
48
|
if args.mime_all:
|
|
@@ -49,10 +76,9 @@ def install_entry(name, console, args, yes=False, ask=True):
|
|
|
49
76
|
_check(name)
|
|
50
77
|
root = store.root_path(name)
|
|
51
78
|
fields = desktop.read_app_desktop(root)
|
|
52
|
-
declared, ignored =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
rw = bool(args.rw) or bool(state and state[1] and not args.mime and not args.mime_all)
|
|
79
|
+
declared, ignored, current, was_rw, has_entry = file_type_state(name, fields)
|
|
80
|
+
mimes = _select(console, declared, args, current if has_entry else None, yes or not ask)
|
|
81
|
+
rw = bool(args.rw) or bool(was_rw and not args.mime and not args.mime_all)
|
|
56
82
|
shown = desktop.display_fields(fields, name)
|
|
57
83
|
console.out(f"Menu entry : {shown['Name']} (appjail) -> {' '.join(desktop.launcher_argv())} {'open' if mimes else 'run'} {name}")
|
|
58
84
|
console.out("File types : " + (", ".join(mimes) + (" (read-write)" if rw else " (read-only)") if mimes else "none (launcher only)"))
|
|
@@ -70,11 +96,15 @@ def install_entry(name, console, args, yes=False, ask=True):
|
|
|
70
96
|
console.out("Icon : " + (f"{size} PNG" if size else "none"))
|
|
71
97
|
if note:
|
|
72
98
|
console.out(f"note: {note}")
|
|
73
|
-
if not desktop.
|
|
99
|
+
if size and not shutil.which(desktop.ICON_CACHE_TOOL):
|
|
100
|
+
console.out("note: gtk-update-icon-cache (libgtk-3-bin) is not installed; the icon may appear only after the next login")
|
|
101
|
+
if mimes and not shutil.which(desktop.DESKTOP_DB_TOOL):
|
|
74
102
|
console.out("note: update-desktop-database (desktop-file-utils) is not installed; the file types may appear after the next login")
|
|
75
103
|
|
|
76
104
|
|
|
77
105
|
def cmd_desktop(args, console):
|
|
106
|
+
if args.prune and args.show:
|
|
107
|
+
raise Abort("--show cannot be combined with --prune")
|
|
78
108
|
if args.prune:
|
|
79
109
|
gone = desktop.dangling()
|
|
80
110
|
for app, path in gone:
|
|
@@ -85,6 +115,11 @@ def cmd_desktop(args, console):
|
|
|
85
115
|
name = args.app
|
|
86
116
|
if not name:
|
|
87
117
|
raise Abort("name an app, or use --prune")
|
|
118
|
+
if args.show:
|
|
119
|
+
if args.remove or args.mime or args.mime_all or args.rw:
|
|
120
|
+
raise Abort("--show cannot be combined with --remove, --mime, --mime-all or --rw")
|
|
121
|
+
show_file_types(name, console)
|
|
122
|
+
return
|
|
88
123
|
if args.remove:
|
|
89
124
|
if not manifest.NAME_RE.fullmatch(name):
|
|
90
125
|
raise Abort("invalid app name")
|
|
@@ -99,13 +134,15 @@ def refresh_after_update(name, console):
|
|
|
99
134
|
if state is None:
|
|
100
135
|
return
|
|
101
136
|
mimes, rw = state
|
|
102
|
-
declared
|
|
137
|
+
declared = file_type_state(name)[0]
|
|
103
138
|
kept = [m for m in mimes if m in declared]
|
|
104
139
|
try:
|
|
105
|
-
desktop.install(name, store.root_path(name), kept, rw)
|
|
140
|
+
_, _, note = desktop.install(name, store.root_path(name), kept, rw)
|
|
106
141
|
except desktop.DesktopError as e:
|
|
107
142
|
console.out(f" menu entry not refreshed: {e}")
|
|
108
143
|
return
|
|
144
|
+
if note:
|
|
145
|
+
console.out(f" menu entry: {note}")
|
|
109
146
|
if dropped := [m for m in mimes if m not in declared]:
|
|
110
147
|
console.out(f" menu entry: no longer offered by the app: {', '.join(dropped)}")
|
|
111
148
|
if new := [m for m in declared if m not in mimes]:
|
|
@@ -28,6 +28,8 @@ MAX_SVG_BYTES = 2 * 1024 * 1024
|
|
|
28
28
|
ICON_SIZE_RANGE = (16, 1024)
|
|
29
29
|
SVG_SIZE = 256
|
|
30
30
|
RSVG = "/usr/bin/rsvg-convert"
|
|
31
|
+
ICON_CACHE_TOOL = "gtk-update-icon-cache"
|
|
32
|
+
DESKTOP_DB_TOOL = "update-desktop-database"
|
|
31
33
|
MAX_MIMES = 32
|
|
32
34
|
MAX_FIELD = 200
|
|
33
35
|
|
|
@@ -288,6 +290,16 @@ def install_icon(name, root, fields, convert=None):
|
|
|
288
290
|
return f"{size[0]}x{size[1]}"
|
|
289
291
|
|
|
290
292
|
|
|
293
|
+
def icon_status(name, root):
|
|
294
|
+
"""What `desktop --show` says about the icon: the installed size, or why there is none."""
|
|
295
|
+
if files := icon_files(name):
|
|
296
|
+
return f"{files[-1].parent.parent.name} PNG"
|
|
297
|
+
data = find_icon(root, read_app_desktop(root))
|
|
298
|
+
if data and data[:8] != b"\x89PNG\r\n\x1a\n" and b"<svg" in data[:4096].lower() and not os.access(RSVG, os.X_OK):
|
|
299
|
+
return "none (SVG icon, rsvg-convert missing: apt install librsvg2-bin, then `appjail desktop` again)"
|
|
300
|
+
return "none"
|
|
301
|
+
|
|
302
|
+
|
|
291
303
|
def remove_icons(name):
|
|
292
304
|
for path in icon_files(name):
|
|
293
305
|
path.unlink(missing_ok=True)
|
|
@@ -296,12 +308,14 @@ def remove_icons(name):
|
|
|
296
308
|
# -- install / remove ----------------------------------------------------------------
|
|
297
309
|
|
|
298
310
|
def refresh_cache():
|
|
299
|
-
"""Tell the desktop about changed entries (desktop-file-utils)
|
|
300
|
-
tool
|
|
301
|
-
if
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
311
|
+
"""Tell the desktop about changed entries (desktop-file-utils) and icons (gtk-update-icon-cache; `-t` because the
|
|
312
|
+
user's hicolor has no index.theme); a missing tool is skipped."""
|
|
313
|
+
if tool := shutil.which(ICON_CACHE_TOOL):
|
|
314
|
+
theme = data_home() / "icons/hicolor"
|
|
315
|
+
if theme.is_dir():
|
|
316
|
+
subprocess.run([tool, "-q", "-t", "-f", str(theme)], capture_output=True, check=False, timeout=60)
|
|
317
|
+
if tool := shutil.which(DESKTOP_DB_TOOL):
|
|
318
|
+
subprocess.run([tool, str(applications_dir())], capture_output=True, check=False, timeout=60)
|
|
305
319
|
|
|
306
320
|
|
|
307
321
|
def install(name, root, mimes=(), rw=False, argv=None, convert=None):
|
|
@@ -80,10 +80,15 @@ SECRET_HOME_DIRS = (".ssh", ".gnupg", ".aws", ".kube", ".docker", ".password-sto
|
|
|
80
80
|
SECRET_SUFFIXES = (".kdbx", ".kdb", ".key", ".pem", ".p12", ".pfx")
|
|
81
81
|
# Too broad: they contain the secrets of other applications and the persistence locations below.
|
|
82
82
|
BROAD_HOME_DIRS = (".config", ".local", ".local/share", ".local/state", ".cache")
|
|
83
|
-
# Writable access would let the app run code outside the jail later (login, shell, desktop, systemd
|
|
83
|
+
# Writable access would let the app run code outside the jail later (login, shell, desktop, systemd, the Python user
|
|
84
|
+
# site that every host Python, appjail included, imports, thumbnailers and file-manager actions). The icon themes are
|
|
85
|
+
# here too: the desktop decodes their images outside any jail, and appjail runs gtk-update-icon-cache on them.
|
|
84
86
|
PERSIST_HOME_DIRS = (".local/bin", ".config/autostart", ".config/systemd", ".config/environment.d", ".config/fish",
|
|
85
87
|
".local/share/applications", ".local/share/systemd", ".local/share/dbus-1", ".bashrc.d",
|
|
86
|
-
".profile.d", ".config/plasma-workspace", ".config/Code", ".config/nvim", ".config/zsh"
|
|
88
|
+
".profile.d", ".config/plasma-workspace", ".config/Code", ".config/nvim", ".config/zsh",
|
|
89
|
+
".local/lib", ".local/share/thumbnailers", ".local/share/kio/servicemenus",
|
|
90
|
+
".local/share/kservices5", ".local/share/nautilus/scripts", ".local/share/nemo/actions",
|
|
91
|
+
".local/share/nemo/scripts", ".local/share/icons", ".icons")
|
|
87
92
|
# Single files that run code outside the jail at login or shell start; never granted read-write.
|
|
88
93
|
PERSIST_HOME_FILES = (".bashrc", ".bash_profile", ".bash_login", ".bash_logout", ".profile", ".zshrc", ".zshenv", ".zprofile",
|
|
89
94
|
".zlogin", ".xprofile", ".xinitrc", ".xsession", ".xsessionrc", ".pam_environment", ".gitconfig", ".npmrc",
|
|
@@ -206,7 +206,8 @@ class App:
|
|
|
206
206
|
("Update", on(lambda a: self.run(argv.update_argv(a)))), ("Update…", self._update_options),
|
|
207
207
|
("Update all", lambda: self.run(argv.update_argv())), ("Portals…", self._portals),
|
|
208
208
|
("History", on(lambda a: self.run(argv.history_argv(a)))),
|
|
209
|
-
("Menu entry…", self._menu_entry), ("
|
|
209
|
+
("Menu entry…", self._menu_entry), ("File types", on(lambda a: self.run(argv.desktop_argv(a, show=True)))),
|
|
210
|
+
("Remove menu entry", on(lambda a: self.run(argv.desktop_argv(a, remove=True)))),
|
|
210
211
|
("Remove app", on(lambda a: self.run(["remove", a]))))):
|
|
211
212
|
ttk.Button(buttons, text=text, command=action).grid(row=i // 5, column=i % 5, sticky="ew", padx=2, pady=2)
|
|
212
213
|
for c in range(5):
|
|
@@ -261,12 +262,24 @@ class App:
|
|
|
261
262
|
app = self.selected()
|
|
262
263
|
if not app:
|
|
263
264
|
return
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
offered, ignored, registered, _rw, _has_entry = apps.file_types(app)
|
|
266
|
+
hint = "highlighted: registered now; click to select or deselect" if registered else "select the types to register; none selected: the command asks"
|
|
267
|
+
if ignored:
|
|
268
|
+
hint += "\nNot offered (refused by appjail): " + ", ".join(ignored)
|
|
269
|
+
fields = [("check", "mime_all", "Offer every file type the app declares"),
|
|
270
|
+
("check", "rw", "Opened files are writable (default: read-only)")]
|
|
271
|
+
if offered:
|
|
272
|
+
fields.insert(0, ("choice", "mime", "File types the app offers", {"items": offered, "selected": registered, "hint": hint}))
|
|
273
|
+
else:
|
|
274
|
+
fields.insert(0, ("list", "mime", "File types to offer", {"hint": "the app declares none that appjail accepts"}))
|
|
275
|
+
|
|
276
|
+
def check(values): # no --mime means "keep the current types" for an entry that has some
|
|
277
|
+
if registered and not values["mime"] and not values["mime_all"]:
|
|
278
|
+
return "Select at least one type, or use Remove menu entry and create the entry again without types."
|
|
279
|
+
return None
|
|
280
|
+
|
|
281
|
+
got = dialogs.options_dialog(self.root, f"Menu entry of {app}", tuple(fields),
|
|
282
|
+
"Creates or refreshes the entry; the command shows what it will register and asks.", validate=check)
|
|
270
283
|
if got:
|
|
271
284
|
self.run(argv.desktop_argv(app, got["mime"], got["mime_all"], got["rw"]))
|
|
272
285
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
from .. import manifest, store, textsafe, updater
|
|
7
7
|
from ..cmd_apps import list_line
|
|
8
|
+
from ..cmd_desktop import file_type_state
|
|
8
9
|
from ..permargs import PERMISSION_FLAGS
|
|
9
10
|
|
|
10
11
|
|
|
@@ -23,11 +24,27 @@ def load_permissions(name):
|
|
|
23
24
|
def detail(name):
|
|
24
25
|
"""The full `list` line of an app (directories, D-Bus names, portals, channel), for the line under the table."""
|
|
25
26
|
try:
|
|
26
|
-
|
|
27
|
+
line = list_line(name, manifest.load(store.manifest_path(name)))
|
|
28
|
+
offered, _ignored, registered, _rw, has_entry = file_types(name)
|
|
29
|
+
if has_entry:
|
|
30
|
+
line += f"; file types: {len(registered)} registered of {len(offered)} offered"
|
|
31
|
+
return textsafe.clean(line, 1000)
|
|
27
32
|
except (manifest.ManifestError, OSError) as e:
|
|
28
33
|
return textsafe.clean(f"{name}: unreadable manifest ({e})", 300)
|
|
29
34
|
|
|
30
35
|
|
|
36
|
+
def file_types(name):
|
|
37
|
+
"""(offered, ignored, registered, rw, has_entry) of an app's menu entry, cleaned; ([], [], [], False, False) when unreadable."""
|
|
38
|
+
try:
|
|
39
|
+
offered, ignored, registered, rw, has_entry = file_type_state(name)
|
|
40
|
+
except (OSError, ValueError):
|
|
41
|
+
return [], [], [], False, False
|
|
42
|
+
def clean(items):
|
|
43
|
+
return [textsafe.clean(m, 130) for m in items]
|
|
44
|
+
|
|
45
|
+
return clean(offered), clean(ignored), clean(registered), rw, has_entry
|
|
46
|
+
|
|
47
|
+
|
|
31
48
|
def rows():
|
|
32
49
|
"""(name, version, source, tier, summary, note) per installed app; an unreadable manifest gives a note instead."""
|
|
33
50
|
result = []
|
|
@@ -125,7 +125,7 @@ def run_argv(app, dirs=(), files=()):
|
|
|
125
125
|
return ["run", app, *_repeat("--dir", dirs), *_repeat("--file", files)]
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
def desktop_argv(app=None, mime=(), mime_all=False, rw=False, remove=False, prune=False):
|
|
128
|
+
def desktop_argv(app=None, mime=(), mime_all=False, rw=False, remove=False, prune=False, show=False):
|
|
129
129
|
argv = ["desktop"]
|
|
130
130
|
if app:
|
|
131
131
|
argv.append(app)
|
|
@@ -133,6 +133,8 @@ def desktop_argv(app=None, mime=(), mime_all=False, rw=False, remove=False, prun
|
|
|
133
133
|
argv.append("--remove")
|
|
134
134
|
if prune:
|
|
135
135
|
argv.append("--prune")
|
|
136
|
+
if show:
|
|
137
|
+
argv.append("--show")
|
|
136
138
|
if mime_all:
|
|
137
139
|
argv.append("--mime-all")
|
|
138
140
|
argv += _repeat("--mime", mime)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"""Modal dialogs: the answers to a command's prompts, an options form, and the permissions editor."""
|
|
5
5
|
|
|
6
6
|
import tkinter as tk
|
|
7
|
-
from tkinter import filedialog, ttk
|
|
7
|
+
from tkinter import filedialog, messagebox, ttk
|
|
8
8
|
|
|
9
9
|
from ..manifest import DISPLAYS
|
|
10
10
|
from ..permargs import PERMISSION_FLAGS
|
|
@@ -169,9 +169,33 @@ class ListEditor(ttk.LabelFrame):
|
|
|
169
169
|
return tuple(self.box.get(0, "end"))
|
|
170
170
|
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
"""A
|
|
174
|
-
|
|
172
|
+
class ChoiceList(ttk.LabelFrame):
|
|
173
|
+
"""A fixed list of strings to select (extra: {"items": [...], "selected": [...], "hint": ...}); values() are the selected ones."""
|
|
174
|
+
|
|
175
|
+
def __init__(self, parent, title, items=(), selected=(), hint=""):
|
|
176
|
+
super().__init__(parent, text=title, padding=6)
|
|
177
|
+
holder = ttk.Frame(self)
|
|
178
|
+
holder.pack(fill="both", expand=True)
|
|
179
|
+
self.box = tk.Listbox(holder, height=max(2, min(len(items), 8)), width=16, exportselection=False, selectmode="multiple")
|
|
180
|
+
bar = ttk.Scrollbar(holder, command=self.box.yview)
|
|
181
|
+
self.box.configure(yscrollcommand=bar.set)
|
|
182
|
+
for i, item in enumerate(items):
|
|
183
|
+
self.box.insert("end", item)
|
|
184
|
+
if item in selected:
|
|
185
|
+
self.box.selection_set(i)
|
|
186
|
+
bar.pack(side="right", fill="y")
|
|
187
|
+
self.box.pack(side="left", fill="both", expand=True)
|
|
188
|
+
if hint:
|
|
189
|
+
ttk.Label(self, text=hint, foreground="gray40", wraplength=480, justify="left").pack(anchor="w", pady=(4, 0))
|
|
190
|
+
|
|
191
|
+
def values(self):
|
|
192
|
+
return tuple(self.box.get(i) for i in self.box.curselection())
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def options_dialog(parent, title, fields, intro="", ok="Continue", validate=None):
|
|
196
|
+
"""A small form. fields: (kind, key, label[, extra]) with kind "check", "text", "combo" (extra: values), "list"
|
|
197
|
+
(extra: {"hint":..., "browse":...}) or "choice" (extra: {"items":..., "selected":..., "hint":...}). validate(values)
|
|
198
|
+
returns an error text to keep the form open. Returns {key: value} or None when cancelled."""
|
|
175
199
|
top = _modal(parent, title)
|
|
176
200
|
frame = ttk.Frame(top, padding=12)
|
|
177
201
|
frame.pack(fill="both", expand=True)
|
|
@@ -186,6 +210,9 @@ def options_dialog(parent, title, fields, intro="", ok="Continue"):
|
|
|
186
210
|
elif kind == "list":
|
|
187
211
|
widgets[key] = ListEditor(frame, label, (), **(extra or {}))
|
|
188
212
|
widgets[key].pack(fill="x", pady=4)
|
|
213
|
+
elif kind == "choice":
|
|
214
|
+
widgets[key] = ChoiceList(frame, label, **(extra or {}))
|
|
215
|
+
widgets[key].pack(fill="x", pady=4)
|
|
189
216
|
else:
|
|
190
217
|
row = ttk.Frame(frame)
|
|
191
218
|
row.pack(fill="x", pady=2)
|
|
@@ -198,7 +225,12 @@ def options_dialog(parent, title, fields, intro="", ok="Continue"):
|
|
|
198
225
|
result = {"value": None}
|
|
199
226
|
|
|
200
227
|
def accept():
|
|
201
|
-
|
|
228
|
+
value = {k: (w.values() if isinstance(w, (ListEditor, ChoiceList)) else w.get()) for k, w in widgets.items()}
|
|
229
|
+
problem = validate(value) if validate else None
|
|
230
|
+
if problem:
|
|
231
|
+
messagebox.showerror("appjail", problem, parent=top)
|
|
232
|
+
return
|
|
233
|
+
result["value"] = value
|
|
202
234
|
top.destroy()
|
|
203
235
|
|
|
204
236
|
buttons = ttk.Frame(frame)
|
|
@@ -20,6 +20,7 @@ from datetime import UTC, datetime
|
|
|
20
20
|
|
|
21
21
|
from . import catalog, store
|
|
22
22
|
from .catalog import IndexProblem
|
|
23
|
+
from .github import COMMIT_RE
|
|
23
24
|
|
|
24
25
|
BUILTIN = "appjail-db"
|
|
25
26
|
BUILTIN_REPO = "alberto743/appjail-db" # GitHub owner/repo of the reference catalog
|
|
@@ -129,7 +130,8 @@ def _state(name):
|
|
|
129
130
|
ok = isinstance(data, dict) and all(
|
|
130
131
|
data.get(k) is None or (isinstance(data.get(k), dict)
|
|
131
132
|
and all(isinstance(data[k].get(f), str) for f in ENTRY_FIELDS)
|
|
132
|
-
and all(isinstance(data[k].get(f, ""), str) for f in OPTIONAL_FIELDS)
|
|
133
|
+
and all(isinstance(data[k].get(f, ""), str) for f in OPTIONAL_FIELDS)
|
|
134
|
+
and (not data[k].get("commit") or COMMIT_RE.fullmatch(data[k]["commit"])))
|
|
133
135
|
for k in ("current", "previous"))
|
|
134
136
|
if not ok:
|
|
135
137
|
raise IndexProblem(f"the state of index source '{name}' is malformed")
|
|
@@ -334,8 +334,7 @@ def check_url(url, stage_dir, etag=None, last_modified=None):
|
|
|
334
334
|
|
|
335
335
|
# -- git jail (manifest history) ------------------------------------------------------
|
|
336
336
|
|
|
337
|
-
GIT_ENV = {"GIT_CONFIG_NOSYSTEM": "1", "GIT_CONFIG_GLOBAL": "/dev/null", "GIT_TERMINAL_PROMPT": "0"
|
|
338
|
-
"GIT_ALLOW_PROTOCOL": "https", "GIT_LFS_SKIP_SMUDGE": "1"}
|
|
337
|
+
GIT_ENV = {"GIT_CONFIG_NOSYSTEM": "1", "GIT_CONFIG_GLOBAL": "/dev/null", "GIT_TERMINAL_PROMPT": "0"}
|
|
339
338
|
|
|
340
339
|
|
|
341
340
|
def local_git_args(workdir, command):
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Alberto P
|
|
2
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
|
|
4
|
+
"""The `linger` setting: keep the jail until every process in it has exited.
|
|
5
|
+
|
|
6
|
+
Some launchers start the real app as a detached child and exit at once (VS Code's CLI does). The jail ends with its main
|
|
7
|
+
command, so the app would die with it. With `linger` the command runs under a small supervisor, written in Python and
|
|
8
|
+
run inside the jail by the system interpreter: it becomes the subreaper of the jail, so detached descendants report to
|
|
9
|
+
it, and it exits, with the command's status, only when nothing but pid 1 and its own starting helpers (a private
|
|
10
|
+
Xwayland) and their children is left.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
|
|
15
|
+
from .jail import RunError
|
|
16
|
+
|
|
17
|
+
PYTHON = "/usr/bin/python3"
|
|
18
|
+
SUPERVISOR = '''\
|
|
19
|
+
import ctypes, os, sys, time
|
|
20
|
+
|
|
21
|
+
def stat(pid):
|
|
22
|
+
try:
|
|
23
|
+
with open(f"/proc/{pid}/stat") as f:
|
|
24
|
+
return f.read().rpartition(")")[2].split()
|
|
25
|
+
except OSError:
|
|
26
|
+
return None
|
|
27
|
+
|
|
28
|
+
def live():
|
|
29
|
+
out = {}
|
|
30
|
+
for name in os.listdir("/proc"):
|
|
31
|
+
if name.isdigit() and (s := stat(name)) and s[0] != "Z":
|
|
32
|
+
out[int(name)] = int(s[1])
|
|
33
|
+
return out
|
|
34
|
+
|
|
35
|
+
def helped(pid, procs):
|
|
36
|
+
while pid in procs:
|
|
37
|
+
if pid in helpers:
|
|
38
|
+
return True
|
|
39
|
+
pid = procs[pid]
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
ctypes.CDLL(None).prctl(36, 1, 0, 0, 0) # PR_SET_CHILD_SUBREAPER
|
|
43
|
+
me = os.getpid()
|
|
44
|
+
helpers = {p for p, parent in live().items() if parent == me}
|
|
45
|
+
cmd = sys.argv[1:]
|
|
46
|
+
child = os.fork()
|
|
47
|
+
if child == 0:
|
|
48
|
+
try:
|
|
49
|
+
os.execvp(cmd[0], cmd)
|
|
50
|
+
except OSError as e:
|
|
51
|
+
print(f"appjail: cannot run {cmd[0]}: {e.strerror}", file=sys.stderr)
|
|
52
|
+
os._exit(127)
|
|
53
|
+
code = None
|
|
54
|
+
while code is None:
|
|
55
|
+
try:
|
|
56
|
+
done, status = os.waitpid(-1, 0)
|
|
57
|
+
except ChildProcessError:
|
|
58
|
+
break
|
|
59
|
+
if done == child:
|
|
60
|
+
code = os.waitstatus_to_exitcode(status)
|
|
61
|
+
if code < 0:
|
|
62
|
+
code = 128 - code
|
|
63
|
+
while True:
|
|
64
|
+
try:
|
|
65
|
+
while os.waitpid(-1, os.WNOHANG)[0]:
|
|
66
|
+
pass
|
|
67
|
+
except ChildProcessError:
|
|
68
|
+
pass
|
|
69
|
+
procs = live()
|
|
70
|
+
if not [p for p in procs if p not in (1, me) and not helped(p, procs)]:
|
|
71
|
+
break
|
|
72
|
+
time.sleep(0.2)
|
|
73
|
+
os._exit(code if code is not None else 0)
|
|
74
|
+
'''
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def wrap(command):
|
|
78
|
+
"""The command run under the supervisor."""
|
|
79
|
+
if not os.access(PYTHON, os.X_OK):
|
|
80
|
+
raise RunError("linger needs python3 in /usr/bin")
|
|
81
|
+
return [PYTHON, "-I", "-c", SUPERVISOR, *command]
|
|
@@ -43,8 +43,8 @@ TOP_KEYS = {
|
|
|
43
43
|
}
|
|
44
44
|
FINGERPRINT_KEYS = {"size", "etag", "last_modified", "chunks"}
|
|
45
45
|
CHANNELS = ("stable", "prerelease", "pinned")
|
|
46
|
-
BOOL_PERMS = ("network", "network_host", "audio", "gpu", "portals", "userns")
|
|
47
|
-
PERM_KEYS = {"network", "network_host", "audio", "gpu", "display", "dbus_filter", "dbus_own", "portals", "portal_interfaces", "userns", "dirs"}
|
|
46
|
+
BOOL_PERMS = ("network", "network_host", "audio", "gpu", "portals", "userns", "linger")
|
|
47
|
+
PERM_KEYS = {"network", "network_host", "audio", "gpu", "display", "dbus_filter", "dbus_own", "portals", "portal_interfaces", "userns", "linger", "dirs"}
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
@dataclass(frozen=True)
|
|
@@ -60,6 +60,7 @@ class Permissions:
|
|
|
60
60
|
portals: bool = False
|
|
61
61
|
portal_interfaces: tuple = () # opt-in portal interfaces beyond the safe set (see PORTAL_OPT_IN)
|
|
62
62
|
userns: bool = False # nested user namespaces and mounts (Electron/Chromium sandboxes, nested bwrap)
|
|
63
|
+
linger: bool = False # keep the jail until every process in it has exited (launchers that detach the real app)
|
|
63
64
|
dirs: tuple = () # "path" (read-only) or "path:rw"; absolute or starting with "~/"
|
|
64
65
|
|
|
65
66
|
|
|
@@ -312,6 +313,7 @@ def dumps(m):
|
|
|
312
313
|
f"portals = {str(p.portals).lower()}",
|
|
313
314
|
f"portal_interfaces = {_array(p.portal_interfaces)}",
|
|
314
315
|
f"userns = {str(p.userns).lower()}",
|
|
316
|
+
*(["linger = true"] if p.linger else []),
|
|
315
317
|
f"dirs = {_array(p.dirs)}",
|
|
316
318
|
"",
|
|
317
319
|
]
|
|
@@ -104,7 +104,7 @@ def permissions_from_args(args):
|
|
|
104
104
|
dirs=dirs_from_args(args.dir), dbus_filter=dbus_from_args(args.dbus),
|
|
105
105
|
dbus_own=dbus_from_args(args.dbus_own, check=grants.check_dbus_own, flag="--dbus-own"),
|
|
106
106
|
network="network" in allowed or "network_host" in allowed, network_host="network_host" in allowed,
|
|
107
|
-
portals="portals" in allowed, userns="userns" in allowed,
|
|
107
|
+
portals="portals" in allowed, userns="userns" in allowed, linger="linger" in allowed,
|
|
108
108
|
audio=not args.no_audio, gpu=not args.no_gpu,
|
|
109
109
|
display=args.display,
|
|
110
110
|
)
|
|
@@ -7,7 +7,7 @@ import os
|
|
|
7
7
|
import stat
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
|
-
from . import grants, store
|
|
10
|
+
from . import grants, linger, store
|
|
11
11
|
from .jail import RunError, etc_args, system_args
|
|
12
12
|
|
|
13
13
|
APP_HOME = "/home/app"
|
|
@@ -210,6 +210,8 @@ def runtime_args(*, root, home, etc_dir, perms, uid, host_env, command, host_hom
|
|
|
210
210
|
manifest asks for but appjail cannot enforce yet is refused instead of ignored.
|
|
211
211
|
"""
|
|
212
212
|
xwayland = perms.display == "xwayland"
|
|
213
|
+
if perms.linger:
|
|
214
|
+
command = linger.wrap(command)
|
|
213
215
|
if xwayland:
|
|
214
216
|
command = xwayland_command(command)
|
|
215
217
|
if (perms.dbus_filter or perms.dbus_own or perms.portals) and not dbus_socket:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|