The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
ci: nuke dead apparmour stuff
Siddarth Kumar8f1a797c91e1
diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.ymlindex d5acd93d0d..3e06403e7a 100644--- a/.github/workflows/build-desktop.yml+++ b/.github/workflows/build-desktop.yml@@ -221,10 +221,6 @@ jobs:xvfb dbus dbus-x11command -v xdg-mime >/dev/null 2>&1 \|| { echo "::error::xdg-mime is still missing after installing xdg-utils"; exit 1; }- if [ "$MATRIX_TARGET" = "x86_64-unknown-linux-gnu" ] \- && ! command -v apparmor_parser >/dev/null 2>&1; then- apt_retry 300 install -y apparmor- fi# NOTE: The post-build dump lives further down (after `cargo tauri build`)# so the binary actually exists when ldd runs. Running it here pre-build# silently no-op'd and gave us no signal during the@@ -480,7 +476,6 @@ jobs:MATRIX_TARGET: ${{ matrix.settings.target }}PROFILE: ${{ inputs.build_profile }}APPIMAGE_RUNTIME_SMOKE: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' && '1' || '0' }}- APPIMAGE_RUNTIME_APPARMOR_USERNS: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' && '1' || '0' }}TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || secrets.UPDATER_PRIVATE_KEY }}TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD || secrets.UPDATER_PRIVATE_KEY_PASSWORD }}run: |diff --git a/scripts/__tests__/validate-appimage-runtime.test.mjs b/scripts/__tests__/validate-appimage-runtime.test.mjsindex ec27b3b125..dcede8b06c 100644--- a/scripts/__tests__/validate-appimage-runtime.test.mjs+++ b/scripts/__tests__/validate-appimage-runtime.test.mjs@@ -194,52 +194,6 @@ test(},);-// The x86_64 smoke path installs a per-executable AppArmor profile, and its-// target was hardcoded to the sharun path. Static validation passed while the-// smoke died on "AppArmor target is not executable" - the same defect as #5606-// one layer down, caught only because the fork demo ran the full matrix.-test(- "the AppArmor smoke target is resolved per layout, not hardcoded",- SKIP,- () => {- const { root, app } = makeLinuxdeployAppDir();- const binDir = fs.mkdtempSync(join(os.tmpdir(), "openhuman-appdir-stub-"));- try {- // Stub the privileged tools so the test exercises target resolution only.- for (const name of ["sudo", "apparmor_parser"]) {- script(join(binDir, name), "#!/bin/sh\nexit 0\n");- }- const profile = join(root, "smoke.profile");- const result = spawnSync(- "bash",- [- "-c",- `source ${JSON.stringify(VALIDATOR)} >/dev/null 2>&1\n` +- `install_smoke_userns_profile ${JSON.stringify(app)} ${JSON.stringify(profile)}`,- ],- {- encoding: "utf8",- env: { ...process.env, PATH: `${binDir}:${process.env.PATH ?? ""}` },- },- );-- assert.doesNotMatch(- result.stderr,- /AppArmor target is not executable/,- "the AppArmor target must resolve for a linuxdeploy AppDir",- );- assert.equal(result.status, 0, result.stderr);- // The profile must confine the real binary, not the sharun path.- const written = fs.readFileSync(profile, "utf8");- assert.match(written, /usr\/bin\/OpenHuman/);- assert.doesNotMatch(written, /shared\/bin/);- } finally {- fs.rmSync(root, { recursive: true, force: true });- fs.rmSync(binDir, { recursive: true, force: true });- }- },-);-// Failure paths: each mutation must be rejected. Without these the validator// could pass everything and nobody would notice until a broken bundle shipped.const MUTATIONS = [diff --git a/scripts/release/test-strip-appimage-rpaths.sh b/scripts/release/test-strip-appimage-rpaths.shindex 334a1cf867..8f152d7b44 100644--- a/scripts/release/test-strip-appimage-rpaths.sh+++ b/scripts/release/test-strip-appimage-rpaths.sh@@ -560,188 +560,6 @@ fiesac) || fail "smoke_extracted_apprun changed a sourced caller's disabled errexit state"-APPARMOR_BIN="$WORK/apparmor-bin"-APPARMOR_RECORD="$WORK/apparmor-command-record"-APPARMOR_PROFILE="$WORK/openhuman-appimage-smoke.profile"-APPARMOR_PROFILE_SNAPSHOT="$WORK/openhuman-appimage-smoke.profile.loaded"-mkdir -p "$APPARMOR_BIN"-printf '%s\n' '#!/usr/bin/env bash' 'exit 0' \- >"$APPARMOR_BIN/apparmor_parser"-printf '%s\n' \- '#!/usr/bin/env bash' \- 'printf "%s\n" "$*" >>"$APPARMOR_RECORD"' \- 'if [ "$2" = "apparmor_parser" ] && [ "$3" = "--replace" ]; then' \- ' cp "$4" "$APPARMOR_PROFILE_SNAPSHOT"' \- 'fi' \- >"$APPARMOR_BIN/sudo"-# Stand in for a restricted Ubuntu 24.04 host so the sysctl branch is exercised-# deterministically on any development machine, including ones with no sysctl-# key of that name at all.-printf '%s\n' \- '#!/usr/bin/env bash' \- 'if [ "${1:-}" = "-n" ]; then' \- ' printf "%s\n" "1"' \- ' exit 0' \- 'fi' \- 'exit 0' \- >"$APPARMOR_BIN/sysctl"-chmod +x \- "$APPARMOR_BIN/apparmor_parser" \- "$APPARMOR_BIN/sudo" \- "$APPARMOR_BIN/sysctl"-export APPARMOR_RECORD APPARMOR_PROFILE_SNAPSHOT-USERNS_SYSCTL="kernel.apparmor_restrict_unprivileged_userns"-PATH="$APPARMOR_BIN:$PATH" install_smoke_userns_profile \- "$RUNTIME_COMPLETE" "$APPARMOR_PROFILE" \- || fail "install_smoke_userns_profile rejected the fixture AppDir"-grep -F "\"$RUNTIME_COMPLETE/shared/bin/OpenHuman\"" \- "$APPARMOR_PROFILE_SNAPSHOT" >/dev/null \- || fail "AppArmor profile did not attach to the extracted real executable"-grep -Fx " userns," "$APPARMOR_PROFILE_SNAPSHOT" >/dev/null \- || fail "AppArmor profile did not preserve Chromium's userns sandbox"-grep -Fx -- \- "--non-interactive apparmor_parser --replace $APPARMOR_PROFILE" \- "$APPARMOR_RECORD" >/dev/null \- || fail "AppArmor profile was not loaded through non-interactive sudo"-PATH="$APPARMOR_BIN:$PATH" remove_smoke_userns_profile "$APPARMOR_PROFILE" \- || fail "remove_smoke_userns_profile rejected the loaded profile"-grep -Fx -- \- "--non-interactive apparmor_parser --remove $APPARMOR_PROFILE" \- "$APPARMOR_RECORD" >/dev/null \- || fail "AppArmor profile was not removed after the smoke"--: >"$APPARMOR_RECORD"-set +e-(- smoke_extracted_apprun() {- printf '%s\n' "smoke" >>"$APPARMOR_RECORD"- return 37- }- PATH="$APPARMOR_BIN:$PATH" smoke_extracted_apprun_with_userns \- "$RUNTIME_COMPLETE" \- "$SMOKE_ROOT/foreign-cwd" \- "$SMOKE_ROOT/apparmor-failure.log" \- "$APPARMOR_PROFILE"-)-apparmor_smoke_status=$?-set -e-[ "$apparmor_smoke_status" -eq 37 ] \- || fail "AppArmor wrapper did not preserve smoke failure status 37"-printf '%s\n' \- "--non-interactive sysctl -q -w $USERNS_SYSCTL=0" \- "--non-interactive apparmor_parser --replace $APPARMOR_PROFILE" \- "smoke" \- "--non-interactive apparmor_parser --remove $APPARMOR_PROFILE" \- "--non-interactive sysctl -q -w $USERNS_SYSCTL=1" \- >"$WORK/apparmor-expected-order"-cmp -s "$WORK/apparmor-expected-order" "$APPARMOR_RECORD" \- || fail "AppArmor profile was not loaded before and removed after a failing smoke"-[ ! -e "$APPARMOR_PROFILE.sysctl" ] \- || fail "userns sysctl state file survived a failing smoke"--APPARMOR_TERM_RECORD="$WORK/apparmor-term-command-record"-APPARMOR_TERM_MARKER="$WORK/apparmor-term-smoke-started"-APPARMOR_TERM_RUNNER="$WORK/apparmor-term-runner.sh"-printf '%s\n' \- '#!/usr/bin/env bash' \- 'set -euo pipefail' \- '# shellcheck source=/dev/null' \- 'source "$RUNTIME_VALIDATOR"' \- 'smoke_extracted_apprun() {' \- ' printf "%s\n" "smoke-start" >>"$APPARMOR_RECORD"' \- ' : >"$APPARMOR_TERM_MARKER"' \- ' while :; do sleep 1; done' \- '}' \- 'smoke_extracted_apprun_with_userns \' \- ' "$RUNTIME_COMPLETE" \' \- ' "$SMOKE_ROOT/foreign-cwd" \' \- ' "$SMOKE_ROOT/apparmor-term.log" \' \- ' "$APPARMOR_PROFILE"' \- >"$APPARMOR_TERM_RUNNER"-chmod +x "$APPARMOR_TERM_RUNNER"-export \- APPARMOR_TERM_MARKER \- RUNTIME_COMPLETE \- RUNTIME_VALIDATOR \- SMOKE_ROOT \- APPARMOR_PROFILE-APPARMOR_RECORD="$APPARMOR_TERM_RECORD" \-PATH="$APPARMOR_BIN:$PATH" \- bash "$APPARMOR_TERM_RUNNER" &-apparmor_term_pid=$!-for _ in $(seq 1 100); do- if [ -s "$APPARMOR_TERM_RECORD" ] && [ -f "$APPARMOR_TERM_MARKER" ]; then- break- fi- sleep 0.05-done-[ -s "$APPARMOR_TERM_RECORD" ] && [ -f "$APPARMOR_TERM_MARKER" ] || {- kill -TERM "$apparmor_term_pid" 2>/dev/null || true- fail "AppArmor TERM fixture did not reach the smoke"-}-kill -TERM "$apparmor_term_pid"-set +e-wait "$apparmor_term_pid"-apparmor_term_status=$?-set -e-[ "$apparmor_term_status" -eq 143 ] \- || fail "AppArmor TERM fixture exited $apparmor_term_status instead of 143"-printf '%s\n' \- "--non-interactive sysctl -q -w $USERNS_SYSCTL=0" \- "--non-interactive apparmor_parser --replace $APPARMOR_PROFILE" \- "smoke-start" \- "--non-interactive apparmor_parser --remove $APPARMOR_PROFILE" \- "--non-interactive sysctl -q -w $USERNS_SYSCTL=1" \- >"$WORK/apparmor-term-expected-order"-cmp -s "$WORK/apparmor-term-expected-order" "$APPARMOR_TERM_RECORD" \- || fail "AppArmor profile was not removed exactly once after TERM"-[ ! -e "$APPARMOR_PROFILE.sysctl" ] \- || fail "userns sysctl state file survived a TERM-interrupted smoke"-echo "[test-rpaths] ok: CI smoke grants userns only to the extracted executable"--# The sysctl toggle must be a no-op on hosts that are already permissive or-# that have no AppArmor userns restriction at all, so the release smoke never-# needs sudo outside the restricted-Ubuntu case it exists for.-USERNS_NOOP_BIN="$WORK/userns-noop-bin"-USERNS_NOOP_RECORD="$WORK/userns-noop-command-record"-USERNS_NOOP_STATE="$WORK/userns-noop.sysctl"-mkdir -p "$USERNS_NOOP_BIN"-printf '%s\n' \- '#!/usr/bin/env bash' \- 'printf "%s\n" "$*" >>"$USERNS_NOOP_RECORD"' \- >"$USERNS_NOOP_BIN/sudo"-chmod +x "$USERNS_NOOP_BIN/sudo"-export USERNS_NOOP_RECORD-for permissive_value in 0 ""; do- : >"$USERNS_NOOP_RECORD"- rm -f "$USERNS_NOOP_STATE"- if [ -n "$permissive_value" ]; then- printf '%s\n' \- '#!/usr/bin/env bash' \- '[ "${1:-}" = "-n" ] && printf "%s\n" "0"' \- 'exit 0' \- >"$USERNS_NOOP_BIN/sysctl"- else- # No such key on this host: sysctl exits non-zero and prints nothing.- printf '%s\n' '#!/usr/bin/env bash' 'exit 1' \- >"$USERNS_NOOP_BIN/sysctl"- fi- chmod +x "$USERNS_NOOP_BIN/sysctl"- PATH="$USERNS_NOOP_BIN:$PATH" \- relax_smoke_userns_restriction "$USERNS_NOOP_STATE" >/dev/null \- || fail "relax_smoke_userns_restriction failed on a permissive host"- [ ! -s "$USERNS_NOOP_RECORD" ] \- || fail "relax_smoke_userns_restriction used sudo on a permissive host"- [ ! -e "$USERNS_NOOP_STATE" ] \- || fail "relax_smoke_userns_restriction recorded state it never changed"- PATH="$USERNS_NOOP_BIN:$PATH" \- restore_smoke_userns_restriction "$USERNS_NOOP_STATE" >/dev/null \- || fail "restore_smoke_userns_restriction failed without recorded state"- [ ! -s "$USERNS_NOOP_RECORD" ] \- || fail "restore_smoke_userns_restriction used sudo without recorded state"-done-echo "[test-rpaths] ok: userns sysctl toggle is a no-op on permissive hosts"-assert_runtime_layout_rejected missing-anylinux \"missing anylinux.so" remove_anylinuxassert_runtime_layout_rejected missing-libxdo \diff --git a/scripts/release/validate-appimage-runtime.sh b/scripts/release/validate-appimage-runtime.shindex d7fff92017..524ec7c738 100755--- a/scripts/release/validate-appimage-runtime.sh+++ b/scripts/release/validate-appimage-runtime.sh@@ -10,12 +10,6 @@# Env:# APPIMAGE_RUNTIME_SMOKE — set to 1 to require the bounded Xvfb startup smoke;# otherwise only static final-artifact checks run-# APPIMAGE_RUNTIME_APPARMOR_USERNS — set to 1 on Ubuntu 24.04 CI to give-# Chromium's sandbox access to user namespaces for-# the smoke window: relaxes-# kernel.apparmor_restrict_unprivileged_userns (and-# restores it afterwards) and loads a temporary,-# per-executable AppArmor profileset -euo pipefail@@ -503,194 +497,6 @@ smoke_extracted_apprun() {echo "[appimage-runtime] Application remained alive for the 15-second startup window"}-# Ubuntu 23.10+ (the hosted ubuntu-24.04 runner included) sets-# `kernel.apparmor_restrict_unprivileged_userns=1`, which denies unprivileged-# user-namespace creation to every *unconfined* process on the box. Chromium's-# zygote needs one, so CEF aborts during startup with-# `FATAL:zygote_host_impl_linux.cc] No usable sandbox!` and the smoke sees exit-# 133 (SIGTRAP) instead of the expected 124 (still alive at the timeout).-#-# `install_smoke_userns_profile` below is Chromium's second documented remedy —-# a per-executable AppArmor profile carrying `userns,`. It loads successfully-# but never takes effect here, because the profile attaches by execve path and-# the sharun launcher runs the app through the AppDir's bundled dynamic loader-# rather than exec'ing `shared/bin/OpenHuman` directly (Chromium then re-execs-# `/proc/self/exe` for the zygote). Toggling the sysctl is Chromium's first-# documented remedy and is path-independent, so it cannot miss the way the-# profile attachment does. The AppArmor profile is retained alongside it: it is-# harmless, and it keeps the narrower per-executable grant in place for hosts-# where the sysctl is unavailable.-#-# The original value is restored after the smoke window so the runner is left-# exactly as it was found.-SMOKE_USERNS_SYSCTL="kernel.apparmor_restrict_unprivileged_userns"--smoke_userns_sysctl_value() {- sysctl -n "$SMOKE_USERNS_SYSCTL" 2>/dev/null || true-}--relax_smoke_userns_restriction() {- local previous_file="$1"- local current- current="$(smoke_userns_sysctl_value)"-- if [ -z "$current" ]; then- echo "[appimage-runtime] $SMOKE_USERNS_SYSCTL is absent; unprivileged user namespaces are already unrestricted"- return 0- fi- if [ "$current" = "0" ]; then- echo "[appimage-runtime] $SMOKE_USERNS_SYSCTL is already 0; leaving it unchanged"- return 0- fi-- command -v sudo >/dev/null 2>&1 \- || { runtime_validation_error "sudo is required to relax $SMOKE_USERNS_SYSCTL for the AppImage smoke"; return 1; }- sudo --non-interactive sysctl -q -w "$SMOKE_USERNS_SYSCTL=0" \- || { runtime_validation_error "could not relax $SMOKE_USERNS_SYSCTL for the AppImage smoke"; return 1; }-- printf '%s\n' "$current" >"$previous_file"- echo "[appimage-runtime] Relaxed $SMOKE_USERNS_SYSCTL: $current -> 0 for the smoke window"-}--restore_smoke_userns_restriction() {- local previous_file="$1"- [ -s "$previous_file" ] || return 0-- local previous- previous="$(cat "$previous_file")"- rm -f "$previous_file"- sudo --non-interactive sysctl -q -w "$SMOKE_USERNS_SYSCTL=$previous" \- || { runtime_validation_error "could not restore $SMOKE_USERNS_SYSCTL to $previous"; return 1; }- echo "[appimage-runtime] Restored $SMOKE_USERNS_SYSCTL to $previous"-}--install_smoke_userns_profile() {- local appdir="$1"- local profile_file="$2"-- # Resolve the target per layout. This was hardcoded to the sharun path- # (shared/bin/OpenHuman), which does not exist in a linuxdeploy AppDir - so the- # x86_64 smoke failed here with "AppArmor target is not executable" even after- # static validation passed. Same defect class as #5606, one layer down.- local layout executable- layout="$(appdir_layout "$appdir" || true)"- if ! executable="$(appdir_main_binary "$appdir" "$layout")"; then- runtime_validation_error "could not resolve the AppArmor target for the $layout layout"- return 1- fi-- [ -x "$executable" ] \- || { runtime_validation_error "AppArmor target is not executable: $executable"; return 1; }- command -v sudo >/dev/null 2>&1 \- || { runtime_validation_error "sudo is required for the AppImage smoke AppArmor profile"; return 1; }- command -v apparmor_parser >/dev/null 2>&1 \- || { runtime_validation_error "apparmor_parser is required for the AppImage smoke AppArmor profile"; return 1; }-- local profile_name="openhuman_appimage_runtime_smoke_$$"- printf '%s\n' \- 'abi <abi/4.0>,' \- 'include <tunables/global>' \- '' \- "profile $profile_name \"$executable\" flags=(unconfined) {" \- ' userns,' \- '}' \- >"$profile_file"-- sudo --non-interactive apparmor_parser --replace "$profile_file" >/dev/null \- || { runtime_validation_error "could not load the AppImage smoke AppArmor profile"; return 1; }- echo "[appimage-runtime] Loaded temporary AppArmor userns profile for: $executable"-}--remove_smoke_userns_profile() {- local profile_file="$1"- sudo --non-interactive apparmor_parser --remove "$profile_file" >/dev/null \- || { runtime_validation_error "could not remove the AppImage smoke AppArmor profile"; return 1; }- echo "[appimage-runtime] Removed temporary AppArmor userns profile: $profile_file"-}--smoke_extracted_apprun_with_userns() {- local appdir="$1"- local foreign_cwd="$2"- local log_file="$3"- local profile_file="$4"- local profile_loaded=0- # Derived rather than passed so the four-argument contract is unchanged.- local userns_sysctl_file="$profile_file.sysctl"- local previous_hup_trap previous_int_trap previous_term_trap- previous_hup_trap="$(trap -p HUP)"- previous_int_trap="$(trap -p INT)"- previous_term_trap="$(trap -p TERM)"-- restore_smoke_signal_traps() {- trap - HUP INT TERM- [ -z "$previous_hup_trap" ] || eval "$previous_hup_trap"- [ -z "$previous_int_trap" ] || eval "$previous_int_trap"- [ -z "$previous_term_trap" ] || eval "$previous_term_trap"- }-- cleanup_smoke_userns_profile() {- if [ "$profile_loaded" -eq 1 ]; then- profile_loaded=0- remove_smoke_userns_profile "$profile_file" \- || echo "[appimage-runtime] ERROR: AppArmor cleanup failed after smoke interruption" >&2- fi- restore_smoke_userns_restriction "$userns_sysctl_file" \- || echo "[appimage-runtime] ERROR: $SMOKE_USERNS_SYSCTL restore failed after smoke interruption" >&2- }-- interrupt_smoke_with_userns() {- local exit_status="$1"- trap - HUP INT TERM- cleanup_smoke_userns_profile- exit "$exit_status"- }- trap 'interrupt_smoke_with_userns 129' HUP- trap 'interrupt_smoke_with_userns 130' INT- trap 'interrupt_smoke_with_userns 143' TERM-- rm -f "$userns_sysctl_file"- if ! relax_smoke_userns_restriction "$userns_sysctl_file"; then- restore_smoke_signal_traps- return 1- fi-- if ! install_smoke_userns_profile "$appdir" "$profile_file"; then- restore_smoke_userns_restriction "$userns_sysctl_file" \- || echo "[appimage-runtime] ERROR: $SMOKE_USERNS_SYSCTL restore failed after AppArmor setup failure" >&2- restore_smoke_signal_traps- return 1- fi- profile_loaded=1-- local smoke_status- if smoke_extracted_apprun "$appdir" "$foreign_cwd" "$log_file"; then- smoke_status=0- else- smoke_status=$?- fi-- profile_loaded=0- local remove_status- if remove_smoke_userns_profile "$profile_file"; then- remove_status=0- else- remove_status=$?- fi-- local restore_status- if restore_smoke_userns_restriction "$userns_sysctl_file"; then- restore_status=0- else- restore_status=$?- fi-- restore_smoke_signal_traps- # Preserve the original smoke failure even if cleanup also fails.- [ "$smoke_status" -eq 0 ] || return "$smoke_status"- [ "$remove_status" -eq 0 ] || return "$remove_status"- return "$restore_status"-}-validate_final_appimage() (local image="$1"if ! image="$(realpath "$image")"; then@@ -729,16 +535,7 @@ validate_final_appimage() (validate_extracted_appdir "$appdir" || return 1if [ "${APPIMAGE_RUNTIME_SMOKE:-0}" = "1" ]; then- if [ "${APPIMAGE_RUNTIME_APPARMOR_USERNS:-0}" = "1" ]; then- smoke_extracted_apprun_with_userns \- "$appdir" \- "$foreign_cwd" \- "$smoke_log" \- "$temp_root/openhuman-appimage-smoke.profile" \- || return 1- else- smoke_extracted_apprun "$appdir" "$foreign_cwd" "$smoke_log" || return 1- fi+ smoke_extracted_apprun "$appdir" "$foreign_cwd" "$smoke_log" || return 1elseecho "[appimage-runtime] Static validation complete; executable smoke disabled for this architecture"fi