Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

System Information: the Sandbox Probe (Checks part 2). The hidden system package sysprobe, started like any isolated app, runs app/probe.c in app mode (that package only): a child forked before the sandbox takes the decoding helpers' profile, the process takes the app sandbox, both try only what must fail (home, system files, root cgroup, sockets, ptrace, user namespace, mount, exec; helper socket, exec, fork, files) plus the broker requests it must refuse, and report as BOP_PROBE (accepted only from that system package; lord-server adds NoNewPrivs, Seccomp, CapEff and the cgroup). On VM 116 every try was refused

Federico Pereira70d84a0f143a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f70797..8c165d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,7 +23,9 @@ of the matching [GitHub release](https://github.com/lordbasex/LordOS/releases),
it or save it to Documents; nothing is sent anywhere. Its Checks tab checks LordOS's claims on this
computer (display server without root, Landlock, the per-app firewall, verified code, the remote
desktop closed when off, app scopes owned by the system) and says whether each was only found
- configured or actually tried.
+ configured or actually tried. **Run tests** starts a test app that tries, inside the same sandbox as
+ any isolated app, what it must not be able to do (your files, sockets, ptrace, leaving its scope,
+ exec), plus the decoders' sandbox and the requests the system must refuse.
- **`lordos-sysreport report`** prints the hardware of this computer and what the system made of it,
as Markdown or `--json`, with no serial numbers, addresses or names: the base of System
Information.
diff --git a/apps/sysinfo/checks.js b/apps/sysinfo/checks.js
index eb9d0a7..2990c5b 100644
--- a/apps/sysinfo/checks.js
+++ b/apps/sysinfo/checks.js
@@ -77,5 +77,48 @@ export function evaluate(ctx) {
return out;
}
-// The checks part 2 adds, shown as not checked yet.
-export const PENDING = ['appSandbox', 'helperSandbox', 'netpermEffective'];
+// ---- part 2: the Sandbox Probe (apps/sysprobe, server/src/app/probe.c) ----
+// result: lord.sysinfo.probe() → { probe: { v, sandbox, tries: [{ id, denied, errno }] },
+// proc: { noNewPrivs, seccomp, capEff, cgroup, memoryMax }, at }.
+
+const KERNEL = ['fsHome', 'fsSystem', 'cgroupEscape', 'netInet', 'netUnix', 'ptrace', 'userns', 'mount', 'exec'];
+const HELPER = ['helperSocket', 'helperExec', 'helperFork', 'helperData'];
+const BROKER = ['brokerFsEscape', 'brokerClipboard', 'brokerFido', 'brokerMail'];
+
+export function evaluateProbe(result) {
+ const p = (result && result.probe) || {}, proc = (result && result.proc) || {};
+ const tries = Array.isArray(p.tries) ? p.tries : [];
+ const by = Object.fromEntries(tries.filter((t) => t && typeof t.id === 'string').map((t) => [t.id, t]));
+ // what got through: a try that must fail and didn't, or one that never ran
+ const leaks = (ids) => ids.filter((id) => !by[id] || by[id].denied !== true);
+ const out = [];
+ const ownOk = by.ownData && by.ownData.denied === false;
+
+ const k = leaks(KERNEL);
+ const procOk = proc.noNewPrivs === '1' && proc.seccomp === '2' && /^0+$/.test(proc.capEff || '');
+ if (!ownOk) out.push(row('appSandbox', '§6.4', 'effective', 'unknown', 'probeBroken'));
+ else if (k.length) out.push(row('appSandbox', '§6.4', 'effective', 'fail', 'sandboxLeaks', { list: k.join(', ') }));
+ else if (!procOk) out.push(row('appSandbox', '§6.4', 'effective', 'warn', 'sandboxProc', { nnp: proc.noNewPrivs || '?', seccomp: proc.seccomp || '?' }));
+ else out.push(row('appSandbox', '§6.4', 'effective', 'pass', 'sandboxOk', { count: KERNEL.length }));
+
+ if (by.helperRan) out.push(row('helperSandbox', '§6.7', 'effective', 'unknown', 'helperNotRun'));
+ else {
+ const h = leaks(HELPER);
+ out.push(row('helperSandbox', '§6.7', 'effective', h.length ? 'fail' : 'pass', h.length ? 'sandboxLeaks' : 'helperOk', h.length ? { list: h.join(', ') } : { count: HELPER.length }));
+ }
+
+ const b = leaks(BROKER);
+ out.push(row('broker', '§6.5', 'effective', b.length ? 'fail' : 'pass', b.length ? 'sandboxLeaks' : 'brokerOk', b.length ? { list: b.join(', ') } : { count: BROKER.length }));
+
+ // its own scope with a memory cap (§6.4: memory.max 512 MB)
+ const scoped = /\/app-lordos-lpk-sysprobe\.scope$/.test(proc.cgroup || '');
+ const mb = /^\d+$/.test(proc.memoryMax || '') ? Math.round(+proc.memoryMax / 1048576) : null;
+ if (!proc.cgroup) out.push(row('appScope', '§6.4', 'configured', 'unknown'));
+ else out.push(row('appScope', '§6.4', 'configured', scoped && mb ? 'pass' : 'warn', scoped ? (mb ? 'scopeOk' : 'scopeNoCap') : 'scopeMissing', { mb: mb || 0 }));
+ return out;
+}
+
+// What part 2 doesn't check yet.
+export const PENDING = ['netpermEffective'];
+// Before the probe has run.
+export const PROBE_CHECKS = ['appSandbox', 'helperSandbox', 'broker', 'appScope'];
diff --git a/apps/sysinfo/index.jsx b/apps/sysinfo/index.jsx
index 42f5066..c9826f8 100644
--- a/apps/sysinfo/index.jsx
+++ b/apps/sysinfo/index.jsx
@@ -9,7 +9,7 @@ import {
fs, userDirs, clipboard, wm, admin, remote, codeStatus,
} from '@lordos/sdk';
import { useMemo, useState } from 'react';
-import { evaluate as evaluateChecks, PENDING as PENDING_CHECKS } from './checks.js';
+import { evaluate as evaluateChecks, evaluateProbe, PENDING as PENDING_CHECKS, PROBE_CHECKS } from './checks.js';
import { cardLayers, sessionLayers, compatibility, hardwareSections, throttleFlags, machineName, compositionReason, reportFileName, reportJson, parseMemoryLines } from './model.js';
// The app's icon: a chip on the brand gradient.
@@ -371,7 +371,29 @@ function CheckRow({ c }) {
);
}
+// The Sandbox Probe (apps/sysprobe): started like any isolated app; its result arrives through
+// lord-server (lord.sysinfo.probe()). It takes well under a second; after 10 s it didn't report.
+function useProbe() {
+ const [st, setSt] = useState(() => { let p = null; try { p = lord.sysinfo.probe(); } catch (e) { /* older server */ } return { busy: false, result: p, error: null }; });
+ const run = () => {
+ const since = Date.now() - 1000;
+ setSt((x) => ({ ...x, busy: true, error: null }));
+ let ok = false;
+ try { ok = !!lord.apps.launchPackage('sysprobe'); } catch (e) { ok = false; }
+ if (!ok) { setSt((x) => ({ ...x, busy: false, error: 'start' })); return; }
+ const t0 = Date.now();
+ const id = setInterval(() => {
+ let p = null;
+ try { p = lord.sysinfo.probe(); } catch (e) { p = null; }
+ if (p && p.at >= since) { clearInterval(id); setSt({ busy: false, result: p, error: null }); }
+ else if (Date.now() - t0 > 10000) { clearInterval(id); setSt((x) => ({ ...x, busy: false, error: 'timeout' })); }
+ }, 250);
+ };
+ return [st, run];
+}
+
function Checks({ r }) {
+ const t = useTheme();
const { t: tr } = useLocale();
const rows = useMemo(() => {
let facts = null, rem = null, stats = null;
@@ -380,12 +402,27 @@ function Checks({ r }) {
try { stats = lord.stats(); } catch (e) { /* no stats */ }
return evaluateChecks({ report: r, facts, code: codeStatus(), remote: rem, stats });
}, [r]);
+ const [probe, runProbe] = useProbe();
+ const probeRows = useMemo(() => (probe.result ? evaluateProbe(probe.result) : null), [probe.result]);
return (
<ScrollView style={{ flex: 1 }}>
<View style={{ padding: spacing.xl, gap: spacing.xl }}>
<GroupBox footer={tr('sysinfo.checksFooter')}>
{rows.map((c) => <CheckRow key={c.id} c={c} />)}
</GroupBox>
+ <View style={{ gap: spacing.s }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: spacing.m }}>
+ <View style={{ flex: 1, gap: 2 }}>
+ <Text style={{ fontSize: typeScale.headline, fontWeight: 600, color: t.text, textAlign: 'start' }}>{tr('sysinfo.probe.title')}</Text>
+ <Text style={{ fontSize: typeScale.callout, color: t.textDim, textAlign: 'start', lineHeight: 1.4 }}>{tr('sysinfo.probe.intro')}</Text>
+ </View>
+ <Button primary label={probe.busy ? tr('sysinfo.probe.running') : probe.result ? tr('sysinfo.probe.again') : tr('sysinfo.probe.run')} disabled={probe.busy} onClick={runProbe} />
+ </View>
+ {probe.error ? <Text style={{ fontSize: typeScale.callout, color: '#ff453a', textAlign: 'start' }}>{tr(`sysinfo.probe.error.${probe.error}`)}</Text> : null}
+ <GroupBox footer={probe.result ? tr('sysinfo.probe.when', { time: new Date(probe.result.at).toLocaleTimeString() }) : null}>
+ {(probeRows || PROBE_CHECKS.map((id) => ({ id, level: 'effective', state: 'pending' }))).map((c) => <CheckRow key={c.id} c={c} />)}
+ </GroupBox>
+ </View>
<GroupBox title={tr('sysinfo.checksPendingTitle')} footer={tr('sysinfo.checksPendingFooter')}>
{PENDING_CHECKS.map((id) => <CheckRow key={id} c={{ id, level: 'effective', state: 'pending' }} />)}
</GroupBox>
diff --git a/apps/sysprobe/index.jsx b/apps/sysprobe/index.jsx
new file mode 100644
index 0000000..17a6b9e
--- /dev/null
+++ b/apps/sysprobe/index.jsx
@@ -0,0 +1,18 @@
+// Sandbox Probe — System Information's test app (docs/BENCHMARK.md, "Checks"). It runs as an isolated
+// process (`lord-server --app sysprobe`), where app mode tries what its sandbox must refuse
+// (server/src/app/probe.c) and reports to lord-server before any of this code would load. This
+// component only shows if the app couldn't start isolated.
+import { View, Text, useTheme, useLocale, typeScale, spacing } from '@lordos/sdk';
+import { Icon as SysInfoIcon } from '../sysinfo/index.jsx';
+
+export function Icon({ size }) { return <SysInfoIcon size={size} />; }
+
+export default function SandboxProbe() {
+ const t = useTheme();
+ const { t: tr } = useLocale();
+ return (
+ <View style={{ flex: 1, padding: spacing.xl, justifyContent: 'center' }}>
+ <Text style={{ fontSize: typeScale.body, color: t.textDim, textAlign: 'center', lineHeight: 1.4 }}>{tr('sysinfo.probe.inProcess')}</Text>
+ </View>
+ );
+}
diff --git a/apps/sysprobe/manifest.json b/apps/sysprobe/manifest.json
new file mode 100644
index 0000000..9a57f89
--- /dev/null
+++ b/apps/sysprobe/manifest.json
@@ -0,0 +1,18 @@
+{
+ "id": "sysprobe",
+ "name": "Sandbox Probe",
+ "description": "System Information's test app: tries what an isolated app must not be able to do",
+ "size": [
+ 420,
+ 220
+ ],
+ "minSize": [
+ 420,
+ 220
+ ],
+ "dock": false,
+ "permissions": [],
+ "category": "System",
+ "process": "isolated",
+ "hidden": true
+}
diff --git a/assets/locales/en/apps.json b/assets/locales/en/apps.json
index 95000c6..d1bd506 100644
--- a/assets/locales/en/apps.json
+++ b/assets/locales/en/apps.json
@@ -29,5 +29,6 @@
"reminders": "Reminders",
"mail": "Mail",
"imager": "LordOS Imager",
- "sysinfo": "System Information"
+ "sysinfo": "System Information",
+ "sysprobe": "Sandbox Probe"
}
diff --git a/assets/locales/en/sysinfo.json b/assets/locales/en/sysinfo.json
index 98d0c64..3cbdf23 100644
--- a/assets/locales/en/sysinfo.json
+++ b/assets/locales/en/sysinfo.json
@@ -10,6 +10,8 @@
"cardTitle": "{card} ({bus})",
"cgroup2": "cgroup v2",
"check.appSandbox": "An isolated app can't get out",
+ "check.appScope": "An isolated app gets its own capped scope",
+ "check.broker": "The broker refuses what isn't granted",
"check.cgroups": "App scopes belong to the system",
"check.code": "Verified system code",
"check.gpu": "Composition on the GPU",
@@ -20,6 +22,7 @@
"check.netpermEffective": "A denied app can't connect",
"check.remoteClosed": "Remote desktop closed when off",
"check.serverUser": "Display server without root",
+ "checkNote.brokerOk": "{count} requests refused: a path outside its folder, the clipboard, the security key, mail",
"checkNote.cgroupsNotSession": "This lord-server isn't in a LordOS session's tree (started from a terminal?)",
"checkNote.cgroupsOk": {
"one": "The session's tree is root's; {scopes} app scope now",
@@ -36,6 +39,8 @@
"other": "{count} components matched their signature this session"
},
"checkNote.gpuOn": "Composed on the GPU ({renderer})",
+ "checkNote.helperNotRun": "The decoders' profile couldn't be applied in the test (the helper exits rather than run without it)",
+ "checkNote.helperOk": "{count} tries refused under the decoders' profile: sockets, exec, fork, files",
"checkNote.landlockNone": "The kernel has no Landlock",
"checkNote.landlockOk": "Landlock ABI {abi}",
"checkNote.landlockOld": "Landlock ABI {abi}: restricted Linux apps need {min} and won't start",
@@ -44,10 +49,17 @@
"checkNote.netpermNoLsm": "Running, but without the BPF security module: Bluetooth can't be denied per app",
"checkNote.netpermOff": "lord-netperm isn't running: per-app network rules aren't applied",
"checkNote.netpermOk": "lord-netperm is running with its kernel programs",
+ "checkNote.probeBroken": "The probe couldn't write to its own folder: its results can't be trusted",
"checkNote.remoteOffClosed": "Off, and nothing listens on port {port}",
"checkNote.remoteOffListening": "Off, but something listens on port {port}",
"checkNote.remoteOnListening": "On by your choice: listening on port {port}",
"checkNote.remoteOnNotListening": "On, but nothing listens on port {port}",
+ "checkNote.sandboxLeaks": "Got through: {list}",
+ "checkNote.sandboxOk": "{count} tries refused: home, system files, cgroup, sockets, ptrace, user namespace, mount, exec; no privileges or capabilities",
+ "checkNote.sandboxProc": "Refused everything, but the process reports no_new_privs {nnp}, seccomp {seccomp}",
+ "checkNote.scopeMissing": "It isn't in an app scope of its own",
+ "checkNote.scopeNoCap": "Its own scope, but without a memory cap",
+ "checkNote.scopeOk": "Its own scope, memory capped at {mb} MB",
"checkNote.serverUserOk": "lord-server runs as user {uid}",
"checkNote.serverUserRoot": "lord-server runs as root",
"checkState.fail": "Failed",
@@ -57,7 +69,7 @@
"checkState.unknown": "Not known",
"checkState.warn": "Warning",
"checksFooter": "Configured: the mechanism is in place. Effective: it was tried and gave the right answer. Nothing here is sent anywhere.",
- "checksPendingFooter": "These need a test app that tries what must fail; they come in a later step.",
+ "checksPendingFooter": "A connection refused by the per-app firewall needs an app with network access and a temporary rule; it comes in a later step.",
"checksPendingTitle": "Coming next",
"compat.batteryHealth": "The battery holds {health} % of its design charge",
"compat.batteryWorn": "The battery holds {health} % of its design charge",
@@ -223,6 +235,15 @@
"power.other": "Power supply",
"power.ups": "UPS",
"power.usb": "USB power",
+ "probe.again": "Run again",
+ "probe.error.start": "The test app couldn't start",
+ "probe.error.timeout": "The test app didn't report within 10 seconds",
+ "probe.inProcess": "This test only runs as an isolated process.",
+ "probe.intro": "Starts a test app the way any isolated app starts and has it try what it must not be able to do. It takes about a second; nothing leaves this computer.",
+ "probe.run": "Run tests",
+ "probe.running": "Testing…",
+ "probe.title": "Sandbox tests",
+ "probe.when": "Last run at {time}",
"reason.capture": "the screen is being recorded, or a remote viewer sees protected windows",
"reason.envOff": "turned off with LORD_GPU=0",
"reason.headless": "this session has no monitor (remote desktop only)",
diff --git a/assets/locales/es/apps.json b/assets/locales/es/apps.json
index defa35d..c745b9b 100644
--- a/assets/locales/es/apps.json
+++ b/assets/locales/es/apps.json
@@ -29,5 +29,6 @@
"reminders": "Recordatorios",
"mail": "Mail",
"imager": "LordOS Imager",
- "sysinfo": "Información del sistema"
+ "sysinfo": "Información del sistema",
+ "sysprobe": "Prueba del aislamiento"
}
diff --git a/assets/locales/es/sysinfo.json b/assets/locales/es/sysinfo.json
index fb1d114..0458d04 100644
--- a/assets/locales/es/sysinfo.json
+++ b/assets/locales/es/sysinfo.json
@@ -10,6 +10,8 @@
"cardTitle": "{card} ({bus})",
"cgroup2": "cgroup v2",
"check.appSandbox": "Una app aislada no puede salir",
+ "check.appScope": "Una app aislada tiene su scope con límite",
+ "check.broker": "El broker niega lo que no está permitido",
"check.cgroups": "Los scopes de las apps son del sistema",
"check.code": "Código del sistema verificado",
"check.gpu": "Composición en la GPU",
@@ -20,6 +22,7 @@
"check.netpermEffective": "Una app bloqueada no puede conectarse",
"check.remoteClosed": "Escritorio remoto cerrado si está apagado",
"check.serverUser": "Servidor gráfico sin root",
+ "checkNote.brokerOk": "{count} pedidos negados: una ruta fuera de su carpeta, el portapapeles, la llave de seguridad, el correo",
"checkNote.cgroupsNotSession": "Este lord-server no está en el árbol de una sesión de LordOS (¿se abrió desde una terminal?)",
"checkNote.cgroupsOk": {
"one": "El árbol de la sesión es de root; {scopes} scope de app ahora",
@@ -36,6 +39,8 @@
"other": "{count} componentes coincidieron con su firma en esta sesión"
},
"checkNote.gpuOn": "Se compone en la GPU ({renderer})",
+ "checkNote.helperNotRun": "No se pudo aplicar el perfil de los decodificadores en la prueba (el helper se cierra antes que correr sin él)",
+ "checkNote.helperOk": "{count} intentos negados con el perfil de los decodificadores: sockets, exec, fork, archivos",
"checkNote.landlockNone": "El kernel no tiene Landlock",
"checkNote.landlockOk": "Landlock ABI {abi}",
"checkNote.landlockOld": "Landlock ABI {abi}: las apps de Linux restringidas necesitan {min} y no van a arrancar",
@@ -44,10 +49,17 @@
"checkNote.netpermNoLsm": "En marcha, pero sin el módulo de seguridad BPF: no se puede negar Bluetooth por app",
"checkNote.netpermOff": "lord-netperm no está en marcha: no se aplican las reglas de red por app",
"checkNote.netpermOk": "lord-netperm está en marcha con sus programas del kernel",
+ "checkNote.probeBroken": "La prueba no pudo escribir en su propia carpeta: no se puede confiar en el resultado",
"checkNote.remoteOffClosed": "Apagado, y nada escucha en el puerto {port}",
"checkNote.remoteOffListening": "Apagado, pero algo escucha en el puerto {port}",
"checkNote.remoteOnListening": "Activado por vos: escucha en el puerto {port}",
"checkNote.remoteOnNotListening": "Activado, pero nada escucha en el puerto {port}",
+ "checkNote.sandboxLeaks": "Pasó: {list}",
+ "checkNote.sandboxOk": "{count} intentos negados: carpeta personal, archivos del sistema, cgroup, sockets, ptrace, user namespace, mount, exec; sin privilegios ni capacidades",
+ "checkNote.sandboxProc": "Negó todo, pero el proceso informa no_new_privs {nnp}, seccomp {seccomp}",
+ "checkNote.scopeMissing": "No está en un scope propio",
+ "checkNote.scopeNoCap": "Su propio scope, pero sin límite de memoria",
+ "checkNote.scopeOk": "Su propio scope, memoria limitada a {mb} MB",
"checkNote.serverUserOk": "lord-server corre como el usuario {uid}",
"checkNote.serverUserRoot": "lord-server corre como root",
"checkState.fail": "Falló",
@@ -57,7 +69,7 @@
"checkState.unknown": "Desconocido",
"checkState.warn": "Advertencia",
"checksFooter": "Configurado: el mecanismo está puesto. Efectivo: se probó y respondió bien. Nada de esto se envía a ningún lado.",
- "checksPendingFooter": "Necesitan una app de prueba que intente lo que tiene que fallar; llegan en un paso siguiente.",
+ "checksPendingFooter": "Una conexión negada por el firewall por app necesita una app con red y una regla temporal; llega en un paso siguiente.",
"checksPendingTitle": "Lo que sigue",
"compat.batteryHealth": "La batería conserva el {health} % de su carga de diseño",
"compat.batteryWorn": "La batería conserva el {health} % de su carga de diseño",
@@ -223,6 +235,15 @@
"power.other": "Fuente",
"power.ups": "UPS",
"power.usb": "Alimentación USB",
+ "probe.again": "Probar de nuevo",
+ "probe.error.start": "No se pudo abrir la app de prueba",
+ "probe.error.timeout": "La app de prueba no respondió en 10 segundos",
+ "probe.inProcess": "Esta prueba solo corre como proceso aislado.",
+ "probe.intro": "Abre una app de prueba como cualquier app aislada y le hace intentar lo que no debería poder hacer. Tarda un segundo; nada sale de este equipo.",
+ "probe.run": "Probar",
+ "probe.running": "Probando…",
+ "probe.title": "Pruebas del aislamiento",
+ "probe.when": "Última prueba a las {time}",
"reason.capture": "se está grabando la pantalla, o alguien ve ventanas protegidas por escritorio remoto",
"reason.envOff": "apagada con LORD_GPU=0",
"reason.headless": "esta sesión no tiene monitor (solo escritorio remoto)",
diff --git a/assets/locales/pt/apps.json b/assets/locales/pt/apps.json
index a5a98f3..b8b265a 100644
--- a/assets/locales/pt/apps.json
+++ b/assets/locales/pt/apps.json
@@ -29,5 +29,6 @@
"reminders": "Lembretes",
"mail": "Mail",
"imager": "LordOS Imager",
- "sysinfo": "Informações do sistema"
+ "sysinfo": "Informações do sistema",
+ "sysprobe": "Teste do isolamento"
}
diff --git a/assets/locales/pt/sysinfo.json b/assets/locales/pt/sysinfo.json
index 9dc1c42..772b67e 100644
--- a/assets/locales/pt/sysinfo.json
+++ b/assets/locales/pt/sysinfo.json
@@ -10,6 +10,8 @@
"cardTitle": "{card} ({bus})",
"cgroup2": "cgroup v2",
"check.appSandbox": "Um app isolado não consegue sair",
+ "check.appScope": "Um app isolado tem seu escopo com limite",
+ "check.broker": "O broker recusa o que não foi permitido",
"check.cgroups": "Os escopos dos apps pertencem ao sistema",
"check.code": "Código do sistema verificado",
"check.gpu": "Composição na GPU",
@@ -20,6 +22,7 @@
"check.netpermEffective": "Um app bloqueado não consegue se conectar",
"check.remoteClosed": "Área de trabalho remota fechada quando desligada",
"check.serverUser": "Servidor gráfico sem root",
+ "checkNote.brokerOk": "{count} pedidos recusados: um caminho fora da pasta, a área de transferência, a chave de segurança, o e-mail",
"checkNote.cgroupsNotSession": "Este lord-server não está na árvore de uma sessão do LordOS (aberto por um terminal?)",
"checkNote.cgroupsOk": {
"one": "A árvore da sessão é do root; {scopes} escopo de app agora",
@@ -36,6 +39,8 @@
"other": "{count} componentes conferiram com a assinatura nesta sessão"
},
"checkNote.gpuOn": "Composta na GPU ({renderer})",
+ "checkNote.helperNotRun": "Não foi possível aplicar o perfil dos decodificadores no teste (o helper fecha em vez de rodar sem ele)",
+ "checkNote.helperOk": "{count} tentativas recusadas com o perfil dos decodificadores: sockets, exec, fork, arquivos",
"checkNote.landlockNone": "O kernel não tem Landlock",
"checkNote.landlockOk": "Landlock ABI {abi}",
"checkNote.landlockOld": "Landlock ABI {abi}: apps Linux restritos precisam de {min} e não vão iniciar",
@@ -44,10 +49,17 @@
"checkNote.netpermNoLsm": "Rodando, mas sem o módulo de segurança BPF: não é possível negar Bluetooth por app",
"checkNote.netpermOff": "lord-netperm não está rodando: as regras de rede por app não são aplicadas",
"checkNote.netpermOk": "lord-netperm está rodando com seus programas do kernel",
+ "checkNote.probeBroken": "O teste não conseguiu escrever na própria pasta: o resultado não é confiável",
"checkNote.remoteOffClosed": "Desligado, e nada escuta na porta {port}",
"checkNote.remoteOffListening": "Desligado, mas algo escuta na porta {port}",
"checkNote.remoteOnListening": "Ativado por você: escutando na porta {port}",
"checkNote.remoteOnNotListening": "Ativado, mas nada escuta na porta {port}",
+ "checkNote.sandboxLeaks": "Passou: {list}",
+ "checkNote.sandboxOk": "{count} tentativas recusadas: pasta pessoal, arquivos do sistema, cgroup, sockets, ptrace, user namespace, mount, exec; sem privilégios nem capacidades",
+ "checkNote.sandboxProc": "Recusou tudo, mas o processo informa no_new_privs {nnp}, seccomp {seccomp}",
+ "checkNote.scopeMissing": "Não está em um escopo próprio",
+ "checkNote.scopeNoCap": "Escopo próprio, mas sem limite de memória",
+ "checkNote.scopeOk": "Escopo próprio, memória limitada a {mb} MB",
"checkNote.serverUserOk": "lord-server roda como o usuário {uid}",
"checkNote.serverUserRoot": "lord-server roda como root",
"checkState.fail": "Falhou",
@@ -57,7 +69,7 @@
"checkState.unknown": "Desconhecido",
"checkState.warn": "Aviso",
"checksFooter": "Configurado: o mecanismo está ativo. Efetivo: foi testado e respondeu certo. Nada disso é enviado.",
- "checksPendingFooter": "Precisam de um app de teste que tente o que deve falhar; chegam numa próxima etapa.",
+ "checksPendingFooter": "Uma conexão recusada pelo firewall por app precisa de um app com rede e uma regra temporária; chega numa próxima etapa.",
"checksPendingTitle": "O que vem a seguir",
"compat.batteryHealth": "A bateria mantém {health} % da carga original",
"compat.batteryWorn": "A bateria mantém {health} % da carga original",
@@ -223,6 +235,15 @@
"power.other": "Fonte",
"power.ups": "Nobreak",
"power.usb": "Alimentação USB",
+ "probe.again": "Testar de novo",
+ "probe.error.start": "Não foi possível abrir o app de teste",
+ "probe.error.timeout": "O app de teste não respondeu em 10 segundos",
+ "probe.inProcess": "Este teste só roda como processo isolado.",
+ "probe.intro": "Abre um app de teste como qualquer app isolado e faz ele tentar o que não deveria conseguir. Leva um segundo; nada sai deste computador.",
+ "probe.run": "Testar",
+ "probe.running": "Testando…",
+ "probe.title": "Testes do isolamento",
+ "probe.when": "Último teste às {time}",
"reason.capture": "a tela está sendo gravada, ou alguém vê janelas protegidas pela área de trabalho remota",
"reason.envOff": "desligada com LORD_GPU=0",
"reason.headless": "esta sessão não tem monitor (só área de trabalho remota)",
diff --git a/docs/BENCHMARK.md b/docs/BENCHMARK.md
index 7c6ab91..8d17ff9 100644
--- a/docs/BENCHMARK.md
+++ b/docs/BENCHMARK.md
@@ -288,12 +288,41 @@ listens on port 5673 in `/proc/net/tcp{,6}`): display server without root (§2.2
`…/lordos-session-<uid>/server`; §11.4), composition on the GPU (§7.3) and lord-server's memory now
(measured, no pass or fail; §7.1). On VM 116 it found two real things: `lord-netperm` isn't installed
there (the unit doesn't exist), and the first run refused a stale `app-host.bundle.js` in the test
-tree. Part 2, the probe app that tries what must fail (sandbox, helper sandbox, a denied connection),
-waits for the maintainer's approval.
+tree. Part 2 is below.
![Checks, part 1](sysinfo-checks.png)
-Not yet: video decode and encode and Vulkan (shown as *Not checked*), Checks part 2.
+**Checks, part 2: the Sandbox Probe (2026-10-26, approved by the maintainer).** A system package,
+`sysprobe` (`apps/sysprobe`, built into `assets/sysapps/sysprobe` like Passwords, hidden from the launcher
+with the new manifest field `"hidden": true`), started with the existing `lord.apps.launchPackage(id)`
+like any isolated app: no new argument, path or exec. In app mode (`app/appclient.c`), for that system
+package only, `app/probe.c` runs instead of the app's code:
+
+1. **Before the app's sandbox**, while the process is single-threaded and has loaded nothing, it forks a
+ child that takes the decoding helpers' profile (`sandbox_apply_helper`, as `lord-doc` and `lord-media`)
+ and tries a unix socket, exec, fork and the app's data folder.
+2. It applies **the same sandbox as any isolated app** (same read-only folders, no network) and tries
+ what must fail: the home folder, `/etc/passwd`, the root cgroup's `cgroup.procs`, an internet and a
+ unix socket, `ptrace`, a user namespace, `mount`, `exec`. Its own data folder must work (the control:
+ a probe that can't write there reports nothing it can be trusted for).
+3. It asks its broker for what must be refused: a path outside its folder, the clipboard without
+ permission, the FIDO2 device, `lord-maild`.
+4. It sends the result as `BOP_PROBE` and exits, without a window. `brokersrv.c` takes `BOP_PROBE` only
+ from that system package, validates the JSON (≤ 8 KB) and adds what only it can read: the process's
+ `NoNewPrivs`, `Seccomp` and `CapEff` and its cgroup with `memory.max`. `lord.sysinfo.probe()` returns
+ the last result; `apps/sysinfo/checks.js` (`evaluateProbe`) turns it into four rows: the app sandbox
+ (§6.4), the helper sandbox (§6.7), the broker (§6.5) and the app's own capped scope (§6.4).
+
+On VM 116, in the isolated headless session, every try was refused (9 + 4 + 4) and the process reported
+no_new_privs, seccomp mode 2 and no capabilities; the scope row is a warning there because that session
+isn't in a LordOS session tree (lord-sessiond refused the scope, as it must). Its first run also caught a
+mistake in the probe itself: stacking the helpers' profile inside the app's sandbox is refused by the
+app's seccomp (rightly), so the helper child now starts before it.
+
+![The Sandbox Probe](sysinfo-probe.png)
+
+Not yet: a connection refused by the per-app firewall (it needs an app with network access and a
+temporary rule), video decode and encode and Vulkan (shown as *Not checked*).
1. `server/src/sysreport/`: collector, GPU layers, `pci.ids`/EDID readers, fake-sysfs fixtures
(AMD desktop, Intel laptop, Nvidia desktop, Raspberry Pi 5, VM), the anonymization test,
diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md
index 46a7414..951386b 100644
--- a/docs/PRIVACY.md
+++ b/docs/PRIVACY.md
@@ -216,6 +216,18 @@ By contrast, the same app opened **in process** (the M7 mode) read `settings.jso
`~/.config/lordos/robado.txt`. That's why a package is now never evaluated in the theme's context
when app mode exists.
+### The Sandbox Probe, on the user's own computer (0.8.5)
+
+`build/sandbox-test` and the malicious app run on development machines. System Information → Checks →
+**Run tests** does the same kind of check on any installed system: it starts the system package
+`sysprobe` the way any isolated app starts, and in app mode `server/src/app/probe.c` (that package only)
+takes the same sandbox and tries what must fail (the home folder, system files, the root cgroup, sockets,
+`ptrace`, a user namespace, `mount`, `exec`), forks a child before the sandbox that takes the decoding
+helpers' profile and tries what must fail there, and asks the broker for what it must refuse. The result
+goes to lord-server as `BOP_PROBE` (only from that system package), which adds the process's
+`NoNewPrivs`, `Seccomp`, `CapEff` and cgroup. It never gets a permission or a network grant; see
+`BENCHMARK.md`, "Checks, part 2".
+
### `build/sandbox-test` (VM)
```
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index 1298659..70b4fc4 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -596,7 +596,8 @@ Details in `MAIL.md`. Tested on VM 123 against local Dovecot, Postfix and Radica
- [x] the read-only `hw-memory-modules` admin action (2026-10-26);
- [x] Overview, Hardware and Compatibility tabs (en, es, pt; 2026-10-26; right to left not yet checked on screen);
- [x] Checks part 1: what lord-server sees itself, configured and effective (2026-10-26);
- - [ ] Checks part 2: the probe app that tries what must fail (needs approval);
+ - [x] Checks part 2: the Sandbox Probe tries what must fail (app sandbox, helper sandbox, broker, scope; 2026-10-26);
+ - [ ] a connection refused by the per-app firewall (an app with network access and a temporary rule);
- [x] reports: the Report tab with the exact text, Copy and Save to Documents (2026-10-26);
- [ ] first real reports from the Pi 5 with a monitor and the RX 580 PC.
- [ ] from the live USB without installing: a *Check this computer* boot entry, reports marked
diff --git a/docs/sysinfo-probe.png b/docs/sysinfo-probe.png
new file mode 100644
index 0000000..16f5c09
Binary files /dev/null and b/docs/sysinfo-probe.png differ
diff --git a/sdk/windows.js b/sdk/windows.js
index 9ba9d53..00b5599 100644
--- a/sdk/windows.js
+++ b/sdk/windows.js
@@ -101,12 +101,13 @@ export const getApp = (id) => registry.get(appIdOf(id));
// "Verified system code"). Packages (.lpk) and Linux apps never are.
export const isSystemApp = (id) => { const a = getApp(id); return !!(a && a.system && !a.package); };
// Live system (ISO): apps with "live": true in their manifest (the installer) only exist there.
+// "hidden": true (System Information's Sandbox Probe) keeps an app out of the launcher and search.
let live = null;
export const isLiveSystem = () => {
if (live === null) { try { live = !!lord.system.info().live; } catch (e) { live = false; } }
return live;
};
-export const listApps = () => [...registry.values()].filter((a) => !a.builtin && (!a.live || isLiveSystem()));
+export const listApps = () => [...registry.values()].filter((a) => !a.builtin && !a.hidden && (!a.live || isLiveSystem()));
export const workArea = (d) => workAreaOf(d);
function place(appId, count, frame) {
diff --git a/server/Makefile b/server/Makefile
index d8be5a6..45ce1ee 100644
--- a/server/Makefile
+++ b/server/Makefile
@@ -54,7 +54,7 @@ MON_SRC := src/monitor/mon.c src/monitor/disktemp.c src/monitor/nethist.c src/mo
MEDIA_SRC := src/media/media.c src/media/hwdec.c src/media/mview.c src/media/capture.c src/media/annot.c src/media/maudio.c src/media/mpulse.c src/media/proto.c src/media/mstream.c src/ui/js_media.c
SEC_SRC := src/sec/json.c src/sec/sign.c src/sec/pkgstate.c src/sec/perms.c src/sec/cgroup.c src/sec/sandbox.c src/sec/brokersrv.c src/sec/brokercam.c src/sec/brokerkr.c src/sec/brokermail.c src/sec/restrict.c src/sec/appid.c src/sec/pwguard.c src/sec/codesig.c
# App mode: lord-server --app <id> runs an .lpk app as an isolated Wayland client (src/app)
-APP_SRC := src/app/appclient.c src/app/appspawn.c src/ui/js_broker.c src/ui/js_brokercam.c src/ui/js_brokermail.c src/app/apphost_bc.c
+APP_SRC := src/app/appclient.c src/app/appspawn.c src/app/probe.c src/ui/js_broker.c src/ui/js_brokercam.c src/ui/js_brokermail.c src/app/apphost_bc.c
SRC := src/main.c src/kms.c src/gpu/gpu.c src/input.c src/canvas.c src/par.c src/admin.c src/install/install.c src/apps.c src/lpk.c src/fsops.c src/remote/mirror.c src/remote/remote_admin.c src/remote/ipnet.c src/remote/rtcwire.c src/remote/ssh_admin.c src/users/users_admin.c src/users/homedirs.c src/keyboard.c src/keylag.c src/ime.c src/wl/wl.c src/wl/x11wire.c src/wl/xwm.c src/wl/xwayland.c \
src/ui/node.c src/ui/style.c src/ui/layout.c src/ui/transform.c src/ui/text.c src/ui/image.c \
src/ui/paint.c src/ui/js.c src/ui/js_sys.c src/ui/js_term.c src/ui/js_wasm.c src/wasm/wasm.c src/wasm/wasm_run.c src/ui/js_sound.c src/ui/js_net.c src/sound/snd.c src/sound/pulse.c src/ui/otf.c src/ui/fonts.c \
diff --git a/server/src/app/appclient.c b/server/src/app/appclient.c
index d9dee84..da8030a 100644
--- a/server/src/app/appclient.c
+++ b/server/src/app/appclient.c
@@ -20,6 +20,7 @@
#include "../keyboard.h"
#include "../lpk.h"
#include "../sec/sandbox.h"
+#include "probe.h"
#include <errno.h>
#include <fcntl.h>
@@ -497,6 +498,22 @@ int app_main(const char *id, const char *theme_bundle, const char *fonts) {
snprintf(data, sizeof data, "%s/%.40s", parent, id);
mkdir(data, 0700);
+ /* System Information's sandbox probe (probe.c): the system package `sysprobe` only. Same sandbox
+ * as any isolated app (the read-only folders below are the ones the main path gives), then it tries
+ * what must fail, reports over its broker and exits: no window, no app code. */
+ if (sys == 1 && !strcmp(id, PROBE_APP_ID)) {
+ char hd[PATH_MAX], lg[PATH_MAX];
+ snprintf(hd, sizeof hd, "%s", theme_bundle);
+ char *sl = strrchr(hd, '/');
+ if (sl) *sl = 0; else snprintf(hd, sizeof hd, ".");
+ snprintf(lg, sizeof lg, "%s/.local/share/lordos/locales", home ? home : "/nonexistent");
+ const char *pro[] = { fonts, hd, "/usr/share/fonts", lg, NULL };
+ SandboxConfig psb = { .id = id, .pkg_dir = dir, .data_dir = data, .runtime_dir = getenv("XDG_RUNTIME_DIR"), .ro_extra = pro, .network = 0 };
+ int hpid = -1, hfd = probe_helper_start(data, &hpid); /* single-threaded, nothing loaded yet */
+ int mask = sandbox_apply(&psb);
+ return probe_main(home ? home : "/nonexistent", data, mask, hfd, hpid);
+ }
+
if (text_init(fonts)) { fprintf(stderr, "lord-server --app: no fonts\n"); return 1; }
{ char a[PATH_MAX * 2]; snprintf(a, sizeof a, "%.*s/..", (int)(sizeof a - 4), fonts); js_sys_set_assets(a); }
kb_set("us", "");
diff --git a/server/src/app/probe.c b/server/src/app/probe.c
new file mode 100644
index 0000000..ebbd83a
--- /dev/null
+++ b/server/src/app/probe.c
@@ -0,0 +1,172 @@
+/* probe.c — System Information's sandbox probe (Checks, part 2; docs/BENCHMARK.md, "Checks:
+ * configured versus effective"). Runs only in app mode for the system package `sysprobe`
+ * (assets/sysapps/sysprobe, found by app_package_dir as a system app), after its sandbox is applied
+ * exactly as for any isolated app, and before any app code would load. It tries what must fail and
+ * sends what happened to lord-server over its own broker (BOP_PROBE), then exits. Nothing here
+ * widens anything: every try is something the sandbox or the broker must refuse, plus two controls
+ * that must work (its own data folder) so a refusal isn't mistaken for a broken probe.
+ *
+ * kernel: the home folder, a system file, the root cgroup's procs, an internet and a unix
+ * socket, ptrace, a user namespace, mount, exec;
+ * helper: a child forked before the app's sandbox takes the decoding helpers' profile
+ * (sandbox_apply_helper) and tries a socket, exec, fork and the app's data folder;
+ * broker: a path outside its data folder, the clipboard without permission, the FIDO2 device,
+ * lord-maild.
+ * lord-server adds what only it can read: the process's NoNewPrivs, Seccomp and capabilities and its
+ * cgroup (brokersrv.c). */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include "probe.h"
+#include "../sec/broker.h"
+#include "../sec/sandbox.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sched.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/ptrace.h>
+#include <sys/socket.h>
+#include <sys/syscall.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+typedef struct { char *p; size_t n, cap; int items; } Out;
+
+static void raw(Out *o, const char *s) {
+ size_t k = strlen(s);
+ if (o->n + k + 1 < o->cap) { memcpy(o->p + o->n, s, k + 1); o->n += k; }
+}
+/* One item of the "tries" list (or several already joined with commas). */
+static void item(Out *o, const char *json) {
+ if (o->items++) raw(o, ",");
+ raw(o, json);
+}
+static void put(Out *o, const char *id, int denied, int err) {
+ char j[96];
+ snprintf(j, sizeof j, "{\"id\":\"%s\",\"denied\":%s,\"errno\":%d}", id, denied ? "true" : "false", err);
+ item(o, j);
+}
+
+/* A call that must fail: denied when it returned < 0 (errno kept). _FD: a call that returns an fd,
+ * closed if it unexpectedly worked. */
+#define MUST_FAIL(o, id, call) do { errno = 0; long r_ = (long)(call); put(o, id, r_ < 0, r_ < 0 ? errno : 0); } while (0)
+#define MUST_FAIL_FD(o, id, call) do { errno = 0; int r_ = (call); int e_ = errno; put(o, id, r_ < 0, r_ < 0 ? e_ : 0); if (r_ >= 0) close(r_); } while (0)
+
+static void kernel_tries(Out *o, const char *home, const char *data) {
+ MUST_FAIL_FD(o, "fsHome", open(home, O_RDONLY | O_DIRECTORY | O_CLOEXEC));
+ MUST_FAIL_FD(o, "fsSystem", open("/etc/passwd", O_RDONLY | O_CLOEXEC));
+ MUST_FAIL_FD(o, "cgroupEscape", open("/sys/fs/cgroup/cgroup.procs", O_WRONLY | O_CLOEXEC));
+ MUST_FAIL_FD(o, "netInet", socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0));
+ MUST_FAIL_FD(o, "netUnix", socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0));
+ MUST_FAIL(o, "ptrace", ptrace(PTRACE_ATTACH, 1, NULL, NULL));
+ MUST_FAIL(o, "userns", unshare(CLONE_NEWUSER));
+ MUST_FAIL(o, "mount", mount("none", "/tmp", "tmpfs", 0, NULL));
+ char *const argv[] = { (char *)"/usr/bin/true", NULL };
+ char *const envp[] = { NULL };
+ MUST_FAIL(o, "exec", execve("/usr/bin/true", argv, envp)); /* returns only if refused */
+ /* the control: its own data folder works */
+ char f[4096];
+ snprintf(f, sizeof f, "%s/.probe", data);
+ int fd = open(f, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0600);
+ int ok = fd >= 0 && write(fd, "ok", 2) == 2;
+ if (fd >= 0) close(fd);
+ unlink(f);
+ put(o, "ownData", !ok, ok ? 0 : errno);
+}
+
+/* The decoding helpers' profile (sandbox_apply_helper, as lord-doc and lord-media take it), in a child
+ * forked BEFORE the app's sandbox: the app's seccomp rightly refuses a second filter, and at that point
+ * the process is single-threaded and has loaded nothing. The child writes its items, joined with
+ * commas, to the pipe; probe_main reads them after the app's own tries. */
+int probe_helper_start(const char *data, int *child) {
+ int pp[2];
+ *child = -1;
+ if (pipe2(pp, O_CLOEXEC)) return -1;
+ pid_t pid = fork();
+ if (pid == 0) {
+ close(pp[0]);
+ SandboxHelperCfg cfg = { .name = "lordos-sysprobe-helper" };
+ sandbox_apply_helper(&cfg); /* exits if seccomp can't be applied (fails closed) */
+ char buf[1024] = "";
+ Out c = { buf, 0, sizeof buf, 0 };
+ MUST_FAIL_FD(&c, "helperSocket", socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0));
+ char *const argv[] = { (char *)"/usr/bin/true", NULL };
+ char *const envp[] = { NULL };
+ MUST_FAIL(&c, "helperExec", execve("/usr/bin/true", argv, envp));
+ pid_t g = fork();
+ if (g == 0) _exit(0);
+ if (g > 0) waitpid(g, NULL, 0);
+ put(&c, "helperFork", g < 0, g < 0 ? errno : 0);
+ char f[4096];
+ snprintf(f, sizeof f, "%s/.probe-helper", data);
+ MUST_FAIL_FD(&c, "helperData", open(f, O_WRONLY | O_CREAT | O_CLOEXEC, 0600));
+ if (write(pp[1], buf, strlen(buf)) < 0) _exit(1);
+ _exit(0);
+ }
+ close(pp[1]);
+ if (pid < 0) { close(pp[0]); return -1; }
+ *child = pid;
+ return pp[0];
+}
+
+static void helper_collect(Out *o, int fd, int child) {
+ char buf[1024];
+ ssize_t n = fd >= 0 ? read(fd, buf, sizeof buf - 1) : -1;
+ if (fd >= 0) close(fd);
+ if (child > 0) waitpid(child, NULL, 0);
+ if (n > 0) { buf[n] = 0; item(o, buf); }
+ else put(o, "helperRan", 1, 0);
+}
+
+/* One synchronous broker request; the reply's status, or -1. */
+static int ask(int bfd, uint16_t op, const void *payload, uint32_t len) {
+ static uint32_t req = 1;
+ BrokerHdr h = { .reqid = req++, .op = op, .status = BROKER_REQ, .len = len };
+ struct iovec iov[2] = { { &h, sizeof h }, { (void *)payload, len } };
+ struct msghdr m = { .msg_iov = iov, .msg_iovlen = len ? 2 : 1 };
+ if (sendmsg(bfd, &m, MSG_NOSIGNAL) < 0) return -1;
+ static char buf[65536];
+ for (int tries = 0; tries < 64; tries++) {
+ BrokerHdr r;
+ struct iovec riov[2] = { { &r, sizeof r }, { buf, sizeof buf } };
+ struct msghdr rm = { .msg_iov = riov, .msg_iovlen = 2 };
+ ssize_t n = recvmsg(bfd, &rm, 0);
+ if (n < (ssize_t)sizeof r) return -1;
+ if (r.reqid == h.reqid) return r.status; /* events (reqid 0) are skipped */
+ }
+ return -1;
+}
+
+static void broker_tries(Out *o, int bfd) {
+ static const char esc[] = "../../.bashrc";
+ int s = ask(bfd, BOP_FS_READ, esc, sizeof esc - 1);
+ put(o, "brokerFsEscape", s == BST_DENIED, 0);
+ s = ask(bfd, BOP_CLIP_GET, NULL, 0);
+ put(o, "brokerClipboard", s == BST_DENIED, 0);
+ s = ask(bfd, BOP_VAULT_FIDO, NULL, 0);
+ put(o, "brokerFido", s == BST_DENIED, 0);
+ static const char mail[] = "list\0";
+ s = ask(bfd, BOP_MAIL, mail, sizeof mail - 1);
+ put(o, "brokerMail", s == BST_DENIED || s == BST_ERROR, 0);
+}
+
+int probe_main(const char *home, const char *data, int sandbox_mask, int helper_fd, int helper_pid) {
+ const char *s = getenv(BROKER_FD_ENV);
+ int bfd = s ? atoi(s) : -1;
+ if (bfd < 0) return 1;
+ static char buf[8192];
+ Out o = { buf, 0, sizeof buf, 0 };
+ char head[96];
+ snprintf(head, sizeof head, "{\"v\":1,\"sandbox\":%d,\"tries\":[", sandbox_mask);
+ raw(&o, head);
+ kernel_tries(&o, home, data);
+ helper_collect(&o, helper_fd, helper_pid);
+ broker_tries(&o, bfd);
+ raw(&o, "]}");
+ int st = ask(bfd, BOP_PROBE, buf, (uint32_t)o.n);
+ return st == BST_OK ? 0 : 1;
+}
diff --git a/server/src/app/probe.h b/server/src/app/probe.h
new file mode 100644
index 0000000..1319758
--- /dev/null
+++ b/server/src/app/probe.h
@@ -0,0 +1,15 @@
+/* probe.h — System Information's sandbox probe (probe.c), run by app mode for the system package
+ * `sysprobe` only, after its sandbox is applied. */
+#ifndef LORD_APP_PROBE_H
+#define LORD_APP_PROBE_H
+
+#define PROBE_APP_ID "sysprobe"
+
+/* Before the app's sandbox: forks the child that takes the decoding helpers' profile and tries what
+ * must fail under it. Returns the pipe to read its result (and its pid in *child), or -1. */
+int probe_helper_start(const char *data, int *child);
+/* After the app's sandbox: tries what must fail, collects the helper child, sends everything to
+ * lord-server (BOP_PROBE) and returns 0 if it was taken. */
+int probe_main(const char *home, const char *data, int sandbox_mask, int helper_fd, int helper_pid);
+
+#endif
diff --git a/server/src/sec/broker.h b/server/src/sec/broker.h
index e84358d..62313f8 100644
--- a/server/src/sec/broker.h
+++ b/server/src/sec/broker.h
@@ -47,6 +47,8 @@ enum BrokerOp {
* come back as "mail" events, in chunks. See brokermail.c, docs/PRIVACY.md */
BOP_SYS_OPEN, /* (those same system apps only) payload "app\0new\0json": open another of them
* with these args (Mail → Calendar for an invitation, Contacts → a new message) */
+ BOP_PROBE, /* (the system package `sysprobe` only, app/probe.c) payload: JSON of what its sandbox
+ * refused; lord-server adds the process's own status and keeps it for lord.sysinfo */
BOP_EVENT = 100, /* server → app, unrequested (reqid 0): payload "type\0json" */
};
@@ -108,6 +110,8 @@ void brokersrv_pick_result(uint32_t reqid, const char *path);
void brokersrv_menu_click(const char *app, const char *item);
/* JSON of the menus an app published (for the system menu bar); "[]" if none. */
const char *brokersrv_menus(const char *app);
+/* System Information's last sandbox probe (BOP_PROBE): JSON { probe, proc, at } or NULL. */
+const char *brokersrv_probe_result(void);
/* The microphone (and later the camera) runs in lord-server: its PipeWire socket has to be
* serviced in the main loop. */
int brokersrv_audio_pollfds(struct pollfd *pfd, int max);
diff --git a/server/src/sec/brokersrv.c b/server/src/sec/brokersrv.c
index f92e055..bca070b 100644
--- a/server/src/sec/brokersrv.c
+++ b/server/src/sec/brokersrv.c
@@ -335,6 +335,59 @@ static int deny_restricted(int fd, uint32_t reqid, const char *id, uint32_t flag
return 1;
}
+/* ---- System Information's sandbox probe (BOP_PROBE) ---- */
+
+static char probe_json[12288];
+static int probe_have;
+
+/* "Key:\tvalue" of /proc/<pid>/status, the first word, [0-9a-f] only */
+static void status_field(const char *st, const char *key, char *out, size_t n) {
+ out[0] = 0;
+ const char *p = st ? strstr(st, key) : NULL;
+ if (!p) return;
+ p += strlen(key);
+ while (*p == ' ' || *p == '\t') p++;
+ size_t o = 0;
+ while (o + 1 < n && ((*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f'))) out[o++] = *p++;
+ out[o] = 0;
+}
+
+static void probe_store(int pid, const char *payload, uint32_t len) {
+ char path[64], st[8192] = "", cg[512] = "", nnp[8], sec[8], cap[24], mem[32] = "";
+ snprintf(path, sizeof path, "/proc/%d/status", pid);
+ int f = pid > 0 ? open(path, O_RDONLY | O_CLOEXEC) : -1;
+ if (f >= 0) { ssize_t n = read(f, st, sizeof st - 1); st[n > 0 ? n : 0] = 0; close(f); }
+ status_field(st, "\nNoNewPrivs:", nnp, sizeof nnp);
+ status_field(st, "\nSeccomp:", sec, sizeof sec);
+ status_field(st, "\nCapEff:", cap, sizeof cap);
+ snprintf(path, sizeof path, "/proc/%d/cgroup", pid);
+ f = pid > 0 ? open(path, O_RDONLY | O_CLOEXEC) : -1;
+ if (f >= 0) { ssize_t n = read(f, cg, sizeof cg - 1); cg[n > 0 ? n : 0] = 0; close(f); }
+ char *c = strstr(cg, "0::");
+ char scope[256] = "";
+ if (c) {
+ c += 3;
+ size_t k = strcspn(c, "\n");
+ if (k < sizeof scope && !memmem(c, k, "..", 2)) { memcpy(scope, c, k); scope[k] = 0; }
+ }
+ for (char *q = scope; *q; q++) if (*q == '"' || *q == '\\' || (unsigned char)*q < 0x20) *q = '_';
+ if (scope[0] == '/') {
+ char mp[400];
+ snprintf(mp, sizeof mp, "/sys/fs/cgroup%s/memory.max", scope);
+ f = open(mp, O_RDONLY | O_CLOEXEC);
+ if (f >= 0) { ssize_t n = read(f, mem, sizeof mem - 1); mem[n > 0 ? n : 0] = 0; mem[strcspn(mem, "\n")] = 0; close(f); }
+ for (char *q = mem; *q; q++) if (!((*q >= '0' && *q <= '9') || (*q >= 'a' && *q <= 'z'))) *q = '_';
+ }
+ struct timespec ts;
+ clock_gettime(CLOCK_REALTIME, &ts);
+ int k = snprintf(probe_json, sizeof probe_json,
+ "{\"probe\":%.*s,\"proc\":{\"noNewPrivs\":\"%s\",\"seccomp\":\"%s\",\"capEff\":\"%s\",\"cgroup\":\"%s\",\"memoryMax\":\"%s\"},\"at\":%lld}",
+ (int)len, payload, nnp, sec, cap, scope, mem, (long long)ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
+ probe_have = k > 0 && (size_t)k < sizeof probe_json;
+}
+
+const char *brokersrv_probe_result(void) { return probe_have ? probe_json : NULL; }
+
static void handle(AppConn *a, BrokerHdr *h, char *payload, int *fds, int nfds) {
int fd = a->fd;
if (h->op == BOP_MAIL) { brokermail_handle((int)(a - apps), fd, h->reqid, a->id, payload, h->len, fds, nfds); return; }
@@ -521,6 +574,19 @@ static void handle(AppConn *a, BrokerHdr *h, char *payload, int *fds, int nfds)
send_reply(fd, h->reqid, BST_OK, NULL, 0);
break;
}
+ case BOP_PROBE: {
+ /* System Information's sandbox probe (app/probe.c): only the system package `sysprobe`, a
+ * bounded JSON payload; lord-server adds what only it can read about that process */
+ JDoc doc;
+ if (!a->sys || strcmp(a->id, "sysprobe") || !h->len || h->len > 8192 || json_parse(payload, h->len, &doc, NULL, 0)) {
+ send_reply(fd, h->reqid, BST_DENIED, NULL, 0);
+ break;
+ }
+ json_free(&doc);
+ probe_store(a->pid, payload, h->len);
+ send_reply(fd, h->reqid, BST_OK, NULL, 0);
+ break;
+ }
case BOP_VAULT_FIDO: {
/* only the system Passwords app (spawned with a vault channel), only with `usb` allowed; the
* hidraw fd goes from here straight to lord-vault */
diff --git a/server/src/ui/js_hw.c b/server/src/ui/js_hw.c
index 5c94adc..ca3ae24 100644
--- a/server/src/ui/js_hw.c
+++ b/server/src/ui/js_hw.c
@@ -28,6 +28,8 @@
* lord.sysinfo.facts() the Checks tab's facts (sysreport/facts.c): lord-server's
* uid/euid, its cgroup and who owns it, app scopes, and
* whether anything listens on the remote desktop's port
+ * lord.sysinfo.probe() the last sandbox probe's result (sec/brokersrv.c, BOP_PROBE:
+ * the system package `sysprobe`, app/probe.c), or null
* lord.sysinfo.markdown() the same report as Markdown, as lordos-sysreport prints it,
* with a "This session" section (System Information's Report tab)
* lord.fan.status() / setProfile(p) / setCurve(pts) / force(v) / caseConfig() (js_fan.c, lord-fand)
@@ -50,6 +52,7 @@
#include "../gpu/gpu.h"
#include "../sysreport/sysreport.h"
#include "../sysreport/facts.h"
+#include "../sec/broker.h"
#include "lord_version.h" /* build/gen: the version for the report */
#include "../hw/mimeapps.h"
#include "../hw/notifyd.h"
@@ -457,8 +460,15 @@ static JSValue f_sysinfo_facts(JSContext *c, JSValueConst t, int argc, JSValueCo
return o;
}
+static JSValue f_sysinfo_probe(JSContext *c, JSValueConst t, int argc, JSValueConst *argv) {
+ (void)t; (void)argc; (void)argv;
+ const char *j = brokersrv_probe_result();
+ return j ? JS_ParseJSON(c, j, strlen(j), "<probe>") : JS_NULL;
+}
+
static const JSCFunctionListEntry sysinfo_funcs[] = {
JS_CFUNC_DEF("report", 0, f_sysinfo_report),
+ JS_CFUNC_DEF("probe", 0, f_sysinfo_probe),
JS_CFUNC_DEF("facts", 0, f_sysinfo_facts),
JS_CFUNC_DEF("markdown", 0, f_sysinfo_markdown),
};
diff --git a/server/tests/sysinfo_model_test.mjs b/server/tests/sysinfo_model_test.mjs
index ed8a8f7..45878ee 100644
--- a/server/tests/sysinfo_model_test.mjs
+++ b/server/tests/sysinfo_model_test.mjs
@@ -1,7 +1,7 @@
// sysinfo_model_test.mjs — System Information's model (apps/sysinfo/model.js, 0.8.5): the GPU layers,
// the reasons for CPU composition, the Compatibility panel and the Hardware sections. Run by
// tests/run_suites.sh (needs node).
-import { evaluate, LIMITS } from '../../apps/sysinfo/checks.js';
+import { evaluate, evaluateProbe, LIMITS } from '../../apps/sysinfo/checks.js';
import { compositionReason, cardLayers, sessionLayers, compatibility, hardwareSections, throttleFlags, machineName, reportFileName, reportJson, parseMemoryLines } from '../../apps/sysinfo/model.js';
let n = 0, bad = 0;
@@ -124,5 +124,25 @@ eq('outside LordOS\'s session tree it is only information', evaluate({ ...good,
{ id: 'cgroups', paper: '§11.4', level: 'configured', state: 'info', note: 'cgroupsNotSession', vars: {} });
eq('nothing known', st(evaluate({})), { serverUser: 'unknown', landlock: 'unknown', netperm: 'unknown', code: 'unknown', remoteClosed: 'unknown', cgroups: 'unknown', gpu: 'warn' });
+// ---- the Sandbox Probe ----
+const tr_ = (ids, denied = true) => ids.map((id) => ({ id, denied, errno: denied ? 13 : 0 }));
+const KER = ['fsHome', 'fsSystem', 'cgroupEscape', 'netInet', 'netUnix', 'ptrace', 'userns', 'mount', 'exec'];
+const HEL = ['helperSocket', 'helperExec', 'helperFork', 'helperData'];
+const BRO = ['brokerFsEscape', 'brokerClipboard', 'brokerFido', 'brokerMail'];
+const okProbe = { probe: { v: 1, sandbox: 63, tries: [...tr_(KER), ...tr_(['ownData'], false), ...tr_(HEL), ...tr_(BRO)] },
+ proc: { noNewPrivs: '1', seccomp: '2', capEff: '0000000000000000', cgroup: '/system.slice/lordos.service/lordos-session-1000/app-lordos-lpk-sysprobe.scope', memoryMax: '536870912' }, at: 1 };
+eq('a tight sandbox', st(evaluateProbe(okProbe)), { appSandbox: 'pass', helperSandbox: 'pass', broker: 'pass', appScope: 'pass' });
+eq('the cap in MB', evaluateProbe(okProbe).find((r) => r.id === 'appScope').vars.mb, 512);
+const leaky = { ...okProbe, probe: { ...okProbe.probe, tries: okProbe.probe.tries.map((x) => (x.id === 'netInet' || x.id === 'helperExec' || x.id === 'brokerFido' ? { ...x, denied: false } : x)) } };
+eq('leaks are named', evaluateProbe(leaky).map((r) => [r.id, r.state, r.vars.list || '']),
+ [['appSandbox', 'fail', 'netInet'], ['helperSandbox', 'fail', 'helperExec'], ['broker', 'fail', 'brokerFido'], ['appScope', 'pass', '']]);
+const missing = { ...okProbe, probe: { ...okProbe.probe, tries: okProbe.probe.tries.filter((x) => x.id !== 'ptrace') } };
+eq('a try that never ran counts as got through', evaluateProbe(missing)[0].vars.list, 'ptrace');
+eq('a broken probe is not a pass', evaluateProbe({ ...okProbe, probe: { ...okProbe.probe, tries: okProbe.probe.tries.map((x) => (x.id === 'ownData' ? { ...x, denied: true } : x)) } })[0].state, 'unknown');
+eq('no seccomp seen from outside', evaluateProbe({ ...okProbe, proc: { ...okProbe.proc, seccomp: '0' } })[0].state, 'warn');
+eq('no scope of its own', evaluateProbe({ ...okProbe, proc: { ...okProbe.proc, cgroup: '/user.slice/x.scope', memoryMax: 'max' } }).find((r) => r.id === 'appScope').note, 'scopeMissing');
+eq('helper never ran', evaluateProbe({ ...okProbe, probe: { ...okProbe.probe, tries: [...tr_(KER), ...tr_(['ownData'], false), ...tr_(['helperRan'])] } }).find((r) => r.id === 'helperSandbox').state, 'unknown');
+eq('garbage does not throw', evaluateProbe({ probe: { tries: [null, 3, { id: 5 }] } }).map((r) => r.state), ['unknown', 'fail', 'fail', 'unknown']);
+
console.log(`sysinfo-model-test: ${n - bad} ok, ${bad} failed`);
process.exit(bad ? 1 : 0);