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 — dedup log falls back to summary; path traversal check is segment-based

Adam Eivyc6b34d3e94e1
diff --git a/server/lib/notesValidation.js b/server/lib/notesValidation.js
index 0a54e516a7..a6519a09f8 100644
--- a/server/lib/notesValidation.js
+++ b/server/lib/notesValidation.js
@@ -3,21 +3,23 @@ import { isAbsolute } from 'path';
// Shared: safe relative path (no traversal, no absolute/drive/UNC forms).
// Rejects:
-// - `..` anywhere (traversal)
+// - any path segment equal to `..` or `.` (traversal) while still allowing
+// filenames like `notes..md` or `v1..v2.md`
// - 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 => {
- 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;
+ const segments = p.split('/');
+ if (segments.some(seg => seg === '..' || seg === '.')) return false;
return true;
},
- { message: 'Path must be relative, forward-slash separated, and cannot contain ..' }
+ { message: 'Path must be relative, forward-slash separated, and cannot contain .. segments' }
);
export const vaultInputSchema = z.object({
diff --git a/server/services/memoryExtractor.js b/server/services/memoryExtractor.js
index bb739b06a6..d1cc8bc95d 100644
--- a/server/services/memoryExtractor.js
+++ b/server/services/memoryExtractor.js
@@ -274,7 +274,10 @@ export async function extractAndStoreMemories(agentId, taskId, output, task = nu
const embedding = await generateMemoryEmbedding(mem);
const existing = await findExistingDuplicate(embedding, mem.content, pendingForDedup.memories);
if (existing) {
- console.log(`🧠 Skipping duplicate memory (similar to "${normalizeText(existing.content).substring(0, 60)}…")`);
+ // Active-memory hits from searchMemories() return metadata with \`summary\`
+ // but no \`content\`; pending hits carry \`content\`. Prefer whichever is present.
+ const existingText = existing.content || existing.summary || '';
+ console.log(`🧠 Skipping duplicate memory (similar to "${normalizeText(existingText).substring(0, 60)}…")`);
skippedDuplicates++;
return null;
}