Skip to content

Commit d131752

Browse files
authored
fix: masking value MCP env field (#5276)
1 parent 9ab69b1 commit d131752

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

web-app/src/routes/settings/mcp-servers.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ import { useToolApproval } from '@/hooks/useToolApproval'
2222
import { toast } from 'sonner'
2323
import { invoke } from '@tauri-apps/api/core'
2424

25+
// Function to mask sensitive values
26+
const maskSensitiveValue = (value: string) => {
27+
if (!value) return value
28+
if (value.length <= 8) return '*'.repeat(value.length)
29+
return value.slice(0, 4) + '*'.repeat(value.length - 8) + value.slice(-4)
30+
}
31+
2532
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2633
export const Route = createFileRoute(route.settings.mcp_servers as any)({
2734
component: MCPServers,
@@ -322,7 +329,10 @@ function MCPServers() {
322329
<div className="break-all">
323330
Env:{' '}
324331
{Object.entries(config.env)
325-
.map(([key, value]) => `${key}=${value}`)
332+
.map(
333+
([key, value]) =>
334+
`${key}=${maskSensitiveValue(value)}`
335+
)
326336
.join(', ')}
327337
</div>
328338
)}

0 commit comments

Comments
 (0)