mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 18:04:59 +00:00
refactor(config): harden catchall hint mapping and array fallback
This commit is contained in:
@@ -17,15 +17,6 @@ function isEnvVarPlaceholder(value: string): boolean {
|
||||
return ENV_VAR_PLACEHOLDER_PATTERN.test(value.trim());
|
||||
}
|
||||
|
||||
function isExtensionPath(path: string): boolean {
|
||||
return (
|
||||
path === "plugins" ||
|
||||
path.startsWith("plugins.") ||
|
||||
path === "channels" ||
|
||||
path.startsWith("channels.")
|
||||
);
|
||||
}
|
||||
|
||||
function isExplicitlyNonSensitivePath(hints: ConfigUiHints | undefined, paths: string[]): boolean {
|
||||
if (!hints) {
|
||||
return false;
|
||||
@@ -130,9 +121,8 @@ function redactObjectWithLookup(
|
||||
if (Array.isArray(obj)) {
|
||||
const path = `${prefix}[]`;
|
||||
if (!lookup.has(path)) {
|
||||
if (!isExtensionPath(prefix)) {
|
||||
return obj;
|
||||
}
|
||||
// Keep behavior symmetric with object fallback: if hints miss the path,
|
||||
// still run pattern-based guessing for non-extension arrays.
|
||||
return redactObjectGuessing(obj, prefix, values, hints);
|
||||
}
|
||||
return obj.map((item) => {
|
||||
@@ -507,9 +497,8 @@ function restoreRedactedValuesWithLookup(
|
||||
// sensitive string array in the config...
|
||||
const { incoming: incomingArray, path } = arrayContext;
|
||||
if (!lookup.has(path)) {
|
||||
if (!isExtensionPath(prefix)) {
|
||||
return incomingArray;
|
||||
}
|
||||
// Keep behavior symmetric with object fallback: if hints miss the path,
|
||||
// still run pattern-based guessing for non-extension arrays.
|
||||
return restoreRedactedValuesGuessing(incomingArray, original, prefix, hints);
|
||||
}
|
||||
return mapRedactedArray({
|
||||
|
||||
Reference in New Issue
Block a user