Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: address review — unused bindings, consistent disk math, cross-platform path validation

Adam Eivy43819f072a44
diff --git a/client/src/pages/Wiki.jsx b/client/src/pages/Wiki.jsx
index d5eeb69461..bdfabfea1e 100644
--- a/client/src/pages/Wiki.jsx
+++ b/client/src/pages/Wiki.jsx
@@ -1,7 +1,6 @@
import { useState, useEffect, useCallback, useMemo } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import * as api from '../services/api';
-import toast from '../components/ui/Toast';
import { BookOpen, Search, Network, FileText, BarChart3, RefreshCw, Activity } from 'lucide-react';
import WikiOverviewTab from '../components/wiki/tabs/OverviewTab';
@@ -27,7 +26,6 @@ export default function Wiki() {
const [selectedVaultId, setSelectedVaultId] = useState(null);
const [loading, setLoading] = useState(true);
const [notes, setNotes] = useState([]);
- const [totalNotes, setTotalNotes] = useState(0);
const loadVaults = useCallback(async () => {
const data = await api.getNotesVaults().catch(() => []);
@@ -43,7 +41,6 @@ export default function Wiki() {
const data = await api.scanNotesVault(selectedVaultId, { limit: 1000 }).catch(() => null);
if (data) {
setNotes(data.notes);
- setTotalNotes(data.total);
}
}, [selectedVaultId]);
diff --git a/server/lib/notesValidation.js b/server/lib/notesValidation.js
index c1df2076a3..0a54e516a7 100644
--- a/server/lib/notesValidation.js
+++ b/server/lib/notesValidation.js
@@ -1,9 +1,23 @@
import { z } from 'zod';
-
-// Shared: safe relative path (no traversal)
+import { isAbsolute } from 'path';
+
+// Shared: safe relative path (no traversal, no absolute/drive/UNC forms).
+// Rejects:
+// - `..` anywhere (traversal)
+// - leading `/` (posix absolute)
+// - Windows drive letters (e.g. `C:\foo`) and UNC paths (e.g. `\\host\share`)
+// - backslashes anywhere (only forward slashes are valid separators)
+// - anything path.isAbsolute recognises on the current platform
const safeRelativePath = z.string().min(1).max(1000).refine(
- p => !p.includes('..') && !p.startsWith('/'),
- { message: 'Path must be relative and cannot contain ..' }
+ p => {
+ if (p.includes('..')) return false;
+ if (p.startsWith('/')) return false;
+ if (p.includes('\\')) return false; // blocks UNC and Windows separators
+ if (/^[A-Za-z]:/.test(p)) return false; // blocks drive-letter prefixes
+ if (isAbsolute(p)) return false;
+ return true;
+ },
+ { message: 'Path must be relative, forward-slash separated, and cannot contain ..' }
);
export const vaultInputSchema = z.object({
diff --git a/server/routes/systemHealth.js b/server/routes/systemHealth.js
index cebdb49029..bd39009931 100644
--- a/server/routes/systemHealth.js
+++ b/server/routes/systemHealth.js
@@ -52,13 +52,16 @@ router.get('/health/details', async (req, res) => {
const cpuCount = os.cpus().length;
const cpuUsagePercent = Math.round((cpuLoad / cpuCount) * 100);
- // Disk usage (root filesystem)
+ // Disk usage (root filesystem).
+ // bavail = blocks available to unprivileged users (what the user can actually fill).
+ // Derive used/usagePercent from the same figure so `used + free === total` and
+ // the UI's percent corresponds to the displayed `free`.
let disk = null;
if (diskStats) {
const totalDisk = diskStats.blocks * diskStats.bsize;
if (totalDisk > 0) {
const freeDisk = diskStats.bavail * diskStats.bsize;
- const usedDisk = totalDisk - (diskStats.bfree * diskStats.bsize);
+ const usedDisk = totalDisk - freeDisk;
const diskUsagePercent = Math.round((usedDisk / totalDisk) * 100);
disk = {
total: totalDisk,