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 in structured error refs

CloudTianTian30d5515d5375
diff --git a/src/main/util/log-redact.ts b/src/main/util/log-redact.ts
index 87934054..df9517ef 100644
--- a/src/main/util/log-redact.ts
+++ b/src/main/util/log-redact.ts
@@ -1,6 +1,8 @@
import * as crypto from 'crypto';
import * as path from 'path';
+import { sanitizeLogTextForUpload } from './log-sanitize';
+
const MAX_LOG_MESSAGE_LEN = 240;
export function maskId(value: unknown): string {
@@ -59,7 +61,9 @@ export function logRenameRef(from: unknown, to: unknown): Record<string, unknown
}
export function sanitizeLogText(value: unknown): string {
- let text = String(value ?? '');
+ // Keep this helper safe when it is used before the central logger hook is
+ // initialized (for example in focused tests and startup error paths).
+ let text = sanitizeLogTextForUpload(String(value ?? ''));
text = text.replace(/cloud\/[^\s'",)]+/g, (m) => `<cloud-path:${hashForLog(m)}>`);
text = text.replace(/\/sync\/[A-Za-z0-9_/-]+/g, (m) => m.split('?')[0]);
text = text.replace(/https?:\/\/[^\s'",)]+/g, (m) => safeUrlAction(m));
diff --git a/test/main/util/log-redact.test.ts b/test/main/util/log-redact.test.ts
index fb8d64b5..53bf4c06 100644
--- a/test/main/util/log-redact.test.ts
+++ b/test/main/util/log-redact.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { redactPaths } from '../../../src/main/util/redact';
-import { logErrorSummary, maskId, safeUrlAction } from '../../../src/main/util/log-redact';
+import { logErrorRef, logErrorSummary, maskId, safeUrlAction } from '../../../src/main/util/log-redact';
describe('log-redact', () => {
it('masks opaque account and local ids while preserving anonymous', () => {
@@ -31,6 +31,18 @@ describe('log-redact', () => {
expect(JSON.stringify(summary)).not.toContain('sk-secret1234567890');
});
+ it('redacts private absolute paths in structured error references', () => {
+ const ref = logErrorRef(
+ new Error("EEXIST: file already exists, mkdir '/Users/test/Private Clips/not-a-directory'"),
+ );
+ const serialized = JSON.stringify(ref);
+
+ expect(serialized).toContain('<abs-path:');
+ expect(serialized).not.toContain('/Users/test');
+ expect(serialized).not.toContain('Private Clips');
+ expect(serialized).not.toContain('not-a-directory');
+ });
+
it('redacts local paths in subprocess stderr tails', () => {
const out = redactPaths(
"ffmpeg failed for /Users/user/Private Clips/demo.mov and C:\\Users\\user\\Videos\\secret.mp4",