mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:37:19 +01:00
Every Linux launch passed --no-sandbox. afterPack.cjs wrapped the Electron binary in a stub that added it unconditionally, the .desktop Exec= line carried it (electron-builder's AppImage default), and the systemd unit from install-fleet-runner.sh passed it again. The reason was real but narrow: inside an AppImage the setuid chrome-sandbox can never work (the FUSE mount is nosuid), so where unprivileged user namespaces are also blocked Chromium aborts at FATAL. Everywhere else the namespace sandbox works without any setuid helper, and the flag switched off the renderer sandbox #1479 had turned on. - desktop/scripts/linux-launcher.sh replaces the stub. It runs Chromium's own probe (create a userns, write its maps, nest another) and the setuid-helper check for .deb installs, and passes --no-sandbox only when neither is available (or as root). It then prints why and how to fix it, and sets FLEET_RUNNER_SANDBOX_OFF. It also reports a --no-sandbox that arrives on argv, including the one electron-builder's AppRun appends silently. - The main process shows that reason as a notification. - linux.executableArgs is [] so the .desktop entry stops passing it. - The systemd unit no longer passes --no-sandbox. - The stale-instance pgrep no longer requires --no-sandbox in argv. - Packaged-build test: test-linux-sandbox.sh starts the real AppImage under Xvfb and checks the live process tree (main argv; renderer seccomp-bpf and its own user namespace). ci-linux-sandbox.sh runs it with Ubuntu's userns restriction off (must be sandboxed) and on (must still start, with the notice). New PR workflow desktop-linux-sandbox.yml, and a step on the Linux release build. - Version 0.8.62 with its changelog entry. Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9 Co-authored-by: Claude <noreply@anthropic.com>
41 lines
1.6 KiB
Bash
Executable File
41 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# CI driver for test-linux-sandbox.sh: proves a packaged AppImage on both
|
|
# kinds of Linux host by flipping Ubuntu's AppArmor userns restriction.
|
|
#
|
|
# desktop/scripts/ci-linux-sandbox.sh <Fleet-Runner-*.AppImage>
|
|
#
|
|
# restriction 0 user namespaces allowed -> must run SANDBOXED
|
|
# restriction 1 user namespaces blocked -> must still start, with the
|
|
# fallback notice (the case that
|
|
# used to FATAL without the flag)
|
|
#
|
|
# Needs passwordless sudo (GitHub's Ubuntu runners have it) and Ubuntu 24.04+,
|
|
# where kernel.apparmor_restrict_unprivileged_userns exists. The original
|
|
# value is restored on exit.
|
|
|
|
set -euo pipefail
|
|
|
|
appimage="${1:?usage: $0 <AppImage>}"
|
|
here="$(cd "$(dirname "$0")" && pwd)"
|
|
knob=/proc/sys/kernel/apparmor_restrict_unprivileged_userns
|
|
|
|
if [ ! -e "$knob" ]; then
|
|
echo "::error::$knob is missing on this runner, so the userns-blocked case cannot be set up." >&2
|
|
echo "This test needs Ubuntu 24.04 or later." >&2
|
|
exit 1
|
|
fi
|
|
command -v xvfb-run >/dev/null 2>&1 || { sudo apt-get update -q && sudo apt-get install -y -q xvfb; }
|
|
|
|
original="$(cat "$knob")"
|
|
trap 'sudo sysctl -q -w kernel.apparmor_restrict_unprivileged_userns="$original"' EXIT
|
|
echo "runner default: kernel.apparmor_restrict_unprivileged_userns=$original"
|
|
|
|
echo "== user namespaces allowed"
|
|
sudo sysctl -q -w kernel.apparmor_restrict_unprivileged_userns=0
|
|
"$here/test-linux-sandbox.sh" "$appimage" sandboxed
|
|
|
|
echo "== user namespaces blocked"
|
|
sudo sysctl -q -w kernel.apparmor_restrict_unprivileged_userns=1
|
|
"$here/test-linux-sandbox.sh" "$appimage" fallback
|