mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix: Finish credential redaction that was merged unfinished (#13073)
* Squash * Removed unused files Not mine, someone merged that stuff in earlier. * fix: patch redaction regressions and schema breakages --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import {
|
||||
defaultValue,
|
||||
hintForPath,
|
||||
humanize,
|
||||
isSensitivePath,
|
||||
pathKey,
|
||||
schemaType,
|
||||
type JsonSchema,
|
||||
@@ -307,7 +306,8 @@ function renderTextInput(params: {
|
||||
const hint = hintForPath(path, hints);
|
||||
const label = hint?.label ?? schema.title ?? humanize(String(path.at(-1)));
|
||||
const help = hint?.help ?? schema.description;
|
||||
const isSensitive = hint?.sensitive ?? isSensitivePath(path);
|
||||
const isSensitive =
|
||||
(hint?.sensitive ?? false) && !/^\$\{[^}]*\}$/.test(String(value ?? "").trim());
|
||||
const placeholder =
|
||||
hint?.placeholder ??
|
||||
// oxlint-disable typescript/no-base-to-string
|
||||
|
||||
@@ -92,14 +92,3 @@ export function humanize(raw: string) {
|
||||
.replace(/\s+/g, " ")
|
||||
.replace(/^./, (m) => m.toUpperCase());
|
||||
}
|
||||
|
||||
export function isSensitivePath(path: Array<string | number>): boolean {
|
||||
const key = pathKey(path).toLowerCase();
|
||||
return (
|
||||
key.includes("token") ||
|
||||
key.includes("password") ||
|
||||
key.includes("secret") ||
|
||||
key.includes("apikey") ||
|
||||
key.endsWith("key")
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user