The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): /config never prints credentials or provider sections
Tekniumc5b6671c1ff3
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsx b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsxindex 324bf0f63df..0b6f95a45ac 100644--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsx@@ -251,6 +251,35 @@ describe('/config', () => {expect(text).not.toContain('voice:')expect(text).toContain('Settings')})++ it('never prints credentials or provider sections, whichever server answered', async () => {+ // A standalone `hermes serve` answers config.get key=full with the raw effective config.+ const requestGateway = gateway(method =>+ method === 'config.get'+ ? {+ config: {+ model: { default: 'm', api_key: 'sk-PROBE-SECRET' },+ providers: { p: { api_key: 'sk-PROBE-SECRET' } },+ custom_providers: [{ name: 'c', api_key: 'sk-PROBE-SECRET' }],+ mcp_servers: { s: { env: { X: 'sk-PROBE-SECRET' } } },+ display: { skin: 'mono' },+ tools: { web: { api_key: 'sk-PROBE-SECRET', bearer_token: 'sk-PROBE-SECRET', backend: 'x' } },+ auth: { password: 'sk-PROBE-SECRET', client_secret: 'sk-PROBE-SECRET' }+ }+ }+ : undefined+ )++ const handle = await mount(requestGateway)++ await handle.submitText('/config')++ const text = renderedText(handle)+ expect(text).toContain('skin: mono')+ expect(text).toContain('backend: x')+ expect(text).not.toContain('sk-PROBE-SECRET')+ expect(text).not.toMatch(/^\s*(model|providers|custom_providers|mcp_servers):/m)+ })})describe('/history', () => {diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.tsindex 63ad36c4029..0e394668c5b 100644--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.ts+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.ts@@ -199,17 +199,33 @@ function formatAgents(subagents: SubagentRow[], processes: ProcessRow[]): stringreturn lines.join('\n')}+// A standalone `hermes serve` answers config.get key=full with the raw effective config, so the+// renderer drops credentials and provider/MCP sections itself rather than trusting the server.+const CONFIG_HIDDEN_SECTIONS = new Set(['custom_providers', 'mcp_servers', 'model', 'providers'])+const CONFIG_SECRET_KEY = /api_?key|secret|password|(^|_)tokens?$/i++const hiddenConfigKey = (key: string, top: boolean) =>+ CONFIG_SECRET_KEY.test(key) || (top && CONFIG_HIDDEN_SECTIONS.has(key))+function yamlLines(value: unknown, indent = ''): string[] {if (value === null || typeof value !== 'object') {return [`${indent}${String(value)}`]}return Object.entries(value as Record<string, unknown>).flatMap(([key, child]) =>- child !== null && typeof child === 'object' && !Array.isArray(child)- ? Object.keys(child).length- ? [`${indent}${key}:`, ...yamlLines(child, `${indent} `)]- : []- : [`${indent}${key}: ${Array.isArray(child) ? JSON.stringify(child) : String(child)}`]+ hiddenConfigKey(key, !indent)+ ? []+ : child !== null && typeof child === 'object' && !Array.isArray(child)+ ? Object.keys(child).length+ ? [`${indent}${key}:`, ...yamlLines(child, `${indent} `)]+ : []+ : [+ `${indent}${key}: ${+ Array.isArray(child)+ ? JSON.stringify(child, (k, v) => (k && CONFIG_SECRET_KEY.test(k) ? undefined : v))+ : String(child)+ }`+ ])}