release: MUA 2026.11.20.r036

Read-only shell
- Accept a full command line (`command`) and parse it without /bin/sh:
  quotes, escapes, ~, pipes between allowed programs, ; && ||, globs in
  absolute paths; 2>&1 and 2>/dev/null are tolerated. Pipeline stages run
  with strictly single-quoted, pre-validated literals only.
- Per-program option policies that understand combined short flags,
  --opt=value and GNU abbreviations. Closes bypasses: ip abbreviations
  (ip a a / ip r d / ip link s), dmesg -c/-Tc/--console-level=, ss -tK/-D,
  date operands, sort -o, uniq output file, file -C.
- Block credential files (shadow, SSH private keys, mua.conf, admin token,
  /proc/*/environ, docker config.v2.json); redact password hashes, private
  PEM keys and WireGuard keys in output. MUA API key and admin token are
  never emitted by any tool.
- More diagnostic programs (echo, printf, sort, uniq, cut, tr, findmnt,
  sensors, zpool/zfs read verbs, mdcmd status, ...). grep without matches
  is reported as no_match instead of an error.

Process handling
- Spawn every child in its own process group; timeouts kill the whole
  tree. The MCP hard timeout kills exactly the processes of that call.
- Async jobs: command in its own file (exit no longer loses the exit
  code), new unraid_system_job_cancel, finished jobs pruned after 7 days.

Other
- Cache toolbox discovery briefly; validate and bound session IDs; /health
  shows version/port only with a valid token; constant-time admin token
  check; auto-granted tools are logged and shown in the WebGUI.
- Remove the legacy PHP server (mcp/), drop old packages from dist/, pin
  @types/bun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikei386andClaude Opus 5.5 committed 2026-11-20 21:51:14 +01:00
1 parent f1df7f9f1c
commit b8d89ffd9c
23 files changed
+1460 -1470

No files matched your search

+4 -1
View File
@@ -141,6 +141,7 @@ $tls_locked = !$config_ok || !empty($transport['envOverride']);
$enabled_tools = $config['enabledTools'] ?? [];
$all_tools_enabled = (bool)($config['allToolsEnabled'] ?? false);
$all_tools = $config['allTools'] ?? [];
$auto_granted = is_array($config['autoGrantedTools'] ?? null) ? $config['autoGrantedTools'] : [];
$toolbox = is_array($config['toolbox'] ?? null) ? $config['toolbox'] : [];
$toolbox_available = (bool)($toolbox['available'] ?? false);
$toolbox_enabled = (bool)($toolbox['enabled'] ?? false);
@@ -220,7 +221,9 @@ $active_count = $all_tools_enabled ? count($all_tools) : count($enabled_tools);
<form method="post" class="mua-preset" onsubmit="<?= $preset[0] === 'preset_all' ? "return confirm('Vollzugriff aktiviert auch Container-Umbau und uneingeschränkte Root-Shell. Wirklich freigeben?');" : '' ?>"><input type="hidden" name="csrf_token" value="<?= htmlspecialchars($unraid_csrf) ?>"><input type="hidden" name="mua_csrf" value="<?= htmlspecialchars($csrf) ?>"><input type="hidden" name="action" value="<?= $preset[0] ?>"><button class="mua-btn <?= $preset[2] === 'danger' ? 'mua-btn-danger' : ($preset[0] === 'preset_readonly' ? 'mua-btn-primary' : '') ?>" type="submit"><?= $preset[1] ?></button></form>
<?php endforeach; ?></div></div>
<div class="mua-section"><h2>Werkzeuge im Detail</h2><form method="post"><input type="hidden" name="csrf_token" value="<?= htmlspecialchars($unraid_csrf) ?>"><input type="hidden" name="mua_csrf" value="<?= htmlspecialchars($csrf) ?>"><input type="hidden" name="action" value="save_tools"><div class="mua-grid">
<div class="mua-section"><h2>Werkzeuge im Detail</h2>
<?php if (!empty($auto_granted)): ?><div class="mua-status warn">Automatisch ergänzt (durch bestehende, gleich starke Freigaben gedeckt): <code><?= htmlspecialchars(implode(', ', $auto_granted)) ?></code>. Sie folgen ihrer Hauptfreigabe (z.B. Root-Shell → Async-Jobs) und entfallen mit ihr.</div><?php endif; ?>
<form method="post"><input type="hidden" name="csrf_token" value="<?= htmlspecialchars($unraid_csrf) ?>"><input type="hidden" name="mua_csrf" value="<?= htmlspecialchars($csrf) ?>"><input type="hidden" name="action" value="save_tools"><div class="mua-grid">
<?php foreach ($risk_groups as $risk => $tools): $meta=$risk_labels[$risk]; ?>
<div class="mua-card <?= $meta[2] ?>"><h3><?= $meta[0] ?> <span class="mua-pill"><?= count($tools) ?></span></h3><p class="mua-muted"><?= $meta[1] ?></p>
<?php foreach ($tools as $tool): $name=$tool['name']; $checked=$all_tools_enabled || in_array($name,$enabled_tools,true); ?>
+12 -10
View File
@@ -41,7 +41,7 @@ class ReleaseTests(unittest.TestCase):
self.assertRegex(current, r"^\d{4}\.\d{2}\.\d{2}\.r\d{3}$")
self.assertEqual(manifest().attrib["version"], current)
self.assertEqual(json.loads((ROOT / "plugin/plugin.json").read_text())["version"], current)
for path in ("src/helpers.ts", "mcp/server.php", "mcp/helpers.php"):
for path in ("src/helpers.ts",):
with self.subTest(path=path):
declared = re.search(r'MUA_VERSION\s*=\s*[\'\"]([^\'\"]+)', (ROOT / path).read_text())
self.assertIsNotNone(declared)
@@ -107,15 +107,17 @@ class ReleaseTests(unittest.TestCase):
result = subprocess.run(["bash", "-n"], input=node.text, text=True, capture_output=True)
self.assertEqual(result.returncode, 0, result.stderr)
def test_r033_archive_is_not_overwritten(self):
archive = ROOT / "dist/mua-2026.11.01.r033-x86_64-1.txz"
self.assertEqual(hashlib.sha256(archive.read_bytes()).hexdigest(),
"ee85aa33230dbb6fe561f8c0000cb854bd542b0da5ad6c1a9100320fc2d5267f")
def test_r034_archive_is_not_overwritten(self):
archive = ROOT / "dist/mua-2026.11.05.r034-x86_64-1.txz"
self.assertEqual(hashlib.sha256(archive.read_bytes()).hexdigest(),
"ed6f1f52474711ac87aba9dd53d3f920c9701373bafc7eeff868ef9a839100ed")
def test_dist_holds_only_the_current_release(self):
# Older packages stay available in git history; keeping only the
# current one in the tree keeps checkouts small (each is ~24 MB).
tracked = subprocess.run(["git", "ls-files", "dist"], cwd=ROOT, text=True,
capture_output=True, check=True).stdout.split()
name = f"dist/mua-{version()}-x86_64-1.txz"
self.assertEqual(sorted(tracked), [name, name + ".sha256"])
payload = next(node for node in manifest().findall("FILE") if node.find("URL") is not None)
digest = hashlib.sha256((ROOT / name).read_bytes()).hexdigest()
self.assertEqual(digest, payload.findtext("SHA256"))
self.assertEqual((ROOT / (name + ".sha256")).read_text().split()[0], digest)
@unittest.skipUnless(os.environ.get("MUA_RELEASE_ARCHIVE"), "set MUA_RELEASE_ARCHIVE after building")
def test_built_archive_matches_manifest_and_expected_files(self):