Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix(logging): redact paths before line breaks

CloudTianTianf354b6731c8b
diff --git a/src/main/util/log-sanitize.ts b/src/main/util/log-sanitize.ts
index c2fb7c68..27a1d602 100644
--- a/src/main/util/log-sanitize.ts
+++ b/src/main/util/log-sanitize.ts
@@ -40,7 +40,9 @@ const QUERY_SECRET_FIELD_RE = new RegExp(
'gi',
);
-const PATH_END = '(?=\\s+(?:then|while|failed|failure|error|at|from|to|for|because|with)\\b|$|[\'",);])';
+// A newline ends a path too: child_process errors ("Command failed: node
+// /Users/x/tool.js\nError: …") would otherwise leave the path unmasked.
+const PATH_END = '(?=\\s+(?:then|while|failed|failure|error|at|from|to|for|because|with)\\b|$|[\\r\\n\'",);])';
const CLOUD_PATH_RE = new RegExp(`\\bcloud\\/[^\\n\\r'",);]+?${PATH_END}`, 'g');
const FILE_URL_RE = new RegExp(`\\bfile:\\/\\/\\/?[^\\n\\r'",);]+?${PATH_END}`, 'gi');
const POSIX_ABS_PATH_RE = new RegExp(`(^|[\\s'",(])((?:\\/Users|\\/private|\\/var|\\/tmp|\\/Volumes|\\/home|\\/opt)\\/[^\\n\\r'",);]+?)${PATH_END}`, 'g');
diff --git a/test/main/util/log-sanitize.test.ts b/test/main/util/log-sanitize.test.ts
index e1c22da0..4db6bd46 100644
--- a/test/main/util/log-sanitize.test.ts
+++ b/test/main/util/log-sanitize.test.ts
@@ -75,6 +75,14 @@ describe('sanitizeLogTextForUpload › set A (must be masked)', () => {
expect(out).not.toContain('Secret Project');
});
+ it('masks an absolute path that ends at a newline (child_process error shape)', () => {
+ const out = sanitizeLogTextForUpload('Command failed: node /Users/test/Secret Project/tool.js\nError: boom');
+ expect(out).toContain('<abs-path:');
+ expect(out).not.toContain('/Users/test');
+ expect(out).not.toContain('Secret Project');
+ expect(out).toContain('\nError: boom');
+ });
+
it('masks Windows absolute paths', () => {
const out = sanitizeLogTextForUpload('copy C:\\Users\\Alice\\Private\\token.txt failed');
expect(out).toContain('<abs-path:');