fix: masking value MCP env field (#5276)
This commit is contained in:
parent
9ab69b157b
commit
d131752419
@ -22,6 +22,13 @@ import { useToolApproval } from '@/hooks/useToolApproval'
|
|||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
import { invoke } from '@tauri-apps/api/core'
|
import { invoke } from '@tauri-apps/api/core'
|
||||||
|
|
||||||
|
// Function to mask sensitive values
|
||||||
|
const maskSensitiveValue = (value: string) => {
|
||||||
|
if (!value) return value
|
||||||
|
if (value.length <= 8) return '*'.repeat(value.length)
|
||||||
|
return value.slice(0, 4) + '*'.repeat(value.length - 8) + value.slice(-4)
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export const Route = createFileRoute(route.settings.mcp_servers as any)({
|
export const Route = createFileRoute(route.settings.mcp_servers as any)({
|
||||||
component: MCPServers,
|
component: MCPServers,
|
||||||
@ -322,7 +329,10 @@ function MCPServers() {
|
|||||||
<div className="break-all">
|
<div className="break-all">
|
||||||
Env:{' '}
|
Env:{' '}
|
||||||
{Object.entries(config.env)
|
{Object.entries(config.env)
|
||||||
.map(([key, value]) => `${key}=${value}`)
|
.map(
|
||||||
|
([key, value]) =>
|
||||||
|
`${key}=${maskSensitiveValue(value)}`
|
||||||
|
)
|
||||||
.join(', ')}
|
.join(', ')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user