fix(config): preserve hidden auth secrets and block scalars

This commit is contained in:
Tam Nhu Tran
2026-03-24 15:25:49 -04:00
parent e983bed1da
commit 6ccf53ec7d
2 changed files with 107 additions and 8 deletions
+33 -2
View File
@@ -201,7 +201,38 @@ function redactYamlScalarLine(line: string): string {
}
function isYamlBlockScalarIndicator(value: string): boolean {
return /^[>|](?:[1-9][+-]?|[+-]?[1-9])?$/.test(value);
const trimmedValue = value.trim();
if (!(trimmedValue.startsWith('|') || trimmedValue.startsWith('>'))) {
return false;
}
const indicators = trimmedValue.slice(1);
if (indicators.length === 0) {
return true;
}
if (indicators.length > 2) {
return false;
}
let sawChompingIndicator = false;
let sawIndentIndicator = false;
for (const indicator of indicators) {
if ((indicator === '+' || indicator === '-') && !sawChompingIndicator) {
sawChompingIndicator = true;
continue;
}
if (/[1-9]/.test(indicator) && !sawIndentIndicator) {
sawIndentIndicator = true;
continue;
}
return false;
}
return true;
}
function shouldRedactRawYamlPath(pathKeys: string[]): boolean {
@@ -404,7 +435,7 @@ function mergeCliproxyAuthConfig(
nextAuth: UnifiedConfig['cliproxy']['auth']
): UnifiedConfig['cliproxy']['auth'] {
if (!nextAuth) {
return undefined;
return currentAuth;
}
const mergedAuth = { ...nextAuth };