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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): redact decision detail before truncating so a boundary-straddling secret can't leak
Adam Eivyd3d37c5691bf
diff --git a/server/services/legacyExport.js b/server/services/legacyExport.jsindex bcc88d4e71..c343e6e569 100644--- a/server/services/legacyExport.js+++ b/server/services/legacyExport.js@@ -411,7 +411,9 @@ function buildDecisionsMd(d) {const when = item.date ? ` _(${String(item.date).slice(0, 10)})_` : '';// The decisions section is a digest — truncate a long brain-entry body to a// single-line summary (the full text already lives in the Brain section).- const detail = item.detail ? ` — ${redactSecrets(truncateOneLine(String(item.detail), 280))}` : '';+ // Redact BEFORE truncating: clipping first could cut a token-shaped secret+ // below redactSecrets' min-length and leak a partial key (e.g. `ghp_0123…`).+ const detail = item.detail ? ` — ${truncateOneLine(redactSecrets(String(item.detail)), 280)}` : '';out.push(`- **${redactSecrets(String(item.label || 'Decision'))}**${detail}${when}`);}return out.join('\n\n');diff --git a/server/services/legacyExport.test.js b/server/services/legacyExport.test.jsindex 2880b03c91..7d191c72d2 100644--- a/server/services/legacyExport.test.js+++ b/server/services/legacyExport.test.js@@ -235,6 +235,17 @@ describe('key decisions section (enriched derivation)', () => {expect(md).toContain('[REDACTED]');expect(md).not.toContain('ghp_0123');});++ it('redacts BEFORE truncating so a secret near the 280-char clip boundary cannot leak partially', () => {+ // Pad so the token straddles the truncation point — redact-after-truncate+ // would clip the token below the regex min-length and leak a `ghp_…` prefix.+ const d = sampleData();+ d.goals = [];+ const padding = 'context '.repeat(34); // ~272 chars before the token+ d.brain.journals = [{ id: 'j', title: 'Decision', content: `${padding}ghp_0123456789abcdefghijklmnopqrstuvwx tail`, tags: ['decision'] }];+ const md = decisionsMd(d);+ expect(md).not.toContain('ghp_0123');+ });});describe('buildManifest', () => {