mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:21:35 +07:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user