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:
Henry Loenwind
2026-02-13 16:19:21 +01:00
committed by GitHub
parent faec6ccb1d
commit 96318641d8
18 changed files with 1641 additions and 1291 deletions

View File

@@ -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

View File

@@ -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")
);
}