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): preserve sanitized URL diagnostics

CloudTianTian6011b855a20e
diff --git a/src/main/util/log-redact.ts b/src/main/util/log-redact.ts
index df9517ef..2b296e8d 100644
--- a/src/main/util/log-redact.ts
+++ b/src/main/util/log-redact.ts
@@ -61,13 +61,17 @@ export function logRenameRef(from: unknown, to: unknown): Record<string, unknown
}
export function sanitizeLogText(value: unknown): string {
- // 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 ?? ''));
+ let text = String(value ?? '');
+ // Normalize sync-specific paths first. The central cloud-path matcher is
+ // intentionally sentence-aware and can otherwise absorb a following
+ // `via <url>` diagnostic into the path hash.
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));
text = text.replace(/\b(ORKLSEC1|ghp|github_pat|sk|sk-proj|xox[baprs])[-_][-_A-Za-z0-9+/=:.]{12,}\b/g, '***REDACTED***');
+ // Keep this helper safe when it is used before the central logger hook is
+ // initialized (for example in focused tests and startup error paths).
+ text = sanitizeLogTextForUpload(text);
if (text.length > MAX_LOG_MESSAGE_LEN) text = `${text.slice(0, MAX_LOG_MESSAGE_LEN)}...`;
return text;
}
diff --git a/test/main/util/log-redact.test.ts b/test/main/util/log-redact.test.ts
index 53bf4c06..51609057 100644
--- a/test/main/util/log-redact.test.ts
+++ b/test/main/util/log-redact.test.ts
@@ -1,6 +1,12 @@
import { describe, expect, it } from 'vitest';
import { redactPaths } from '../../../src/main/util/redact';
-import { logErrorRef, logErrorSummary, maskId, safeUrlAction } from '../../../src/main/util/log-redact';
+import {
+ logErrorRef,
+ logErrorSummary,
+ maskId,
+ safeUrlAction,
+ sanitizeLogText,
+} from '../../../src/main/util/log-redact';
describe('log-redact', () => {
it('masks opaque account and local ids while preserving anonymous', () => {
@@ -43,6 +49,19 @@ describe('log-redact', () => {
expect(serialized).not.toContain('not-a-directory');
});
+ it('preserves safe URLs adjacent to cloud paths while redacting secrets', () => {
+ const text = sanitizeLogText(
+ 'failed cloud/agents/abc123/skills/private/SKILL.md via https://example.com/sync/sts?token=secret ghp_abcdefghijklmnopqrstuvwxyz',
+ );
+
+ expect(text).toContain('<cloud-path:');
+ expect(text).toContain('https://example.com/sync/sts');
+ expect(text).toContain('***REDACTED***');
+ expect(text).not.toContain('private/SKILL.md');
+ expect(text).not.toContain('token=secret');
+ expect(text).not.toContain('ghp_abcdefghijklmnopqrstuvwxyz');
+ });
+
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",