fix(ui): redact sensitive config values in diff panel

Use isSensitiveConfigPath to detect token/password/secret/apiKey paths
and display REDACTED_PLACEHOLDER instead of raw values in the config
diff panel, preventing credential exposure in the UI.
This commit is contained in:
Val Alexander
2026-03-23 20:48:08 -05:00
parent 21ac4b9a8a
commit 9dd0530b97

View File

@@ -7,6 +7,7 @@ import type { ConfigUiHints } from "../types.ts";
import {
countSensitiveConfigValues,
humanize,
isSensitiveConfigPath,
pathKey,
REDACTED_PLACEHOLDER,
schemaType,
@@ -554,6 +555,9 @@ function truncateValue(value: unknown, maxLen = 40): string {
}
function renderDiffValue(path: string, value: unknown, _uiHints: ConfigUiHints): string {
if (isSensitiveConfigPath(path) && value != null && truncateValue(value).trim() !== "") {
return REDACTED_PLACEHOLDER;
}
return truncateValue(value);
}