Merge branch 'sipeed:main' into main

This commit is contained in:
github-actions[bot] 2026-03-24 04:38:21 +00:00 committed by GitHub
commit 834e1354c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,13 +4,20 @@ export function maskedSecretPlaceholder(value: unknown, fallback = ""): string {
return fallback return fallback
} }
if (secret.length < 7) { // ensure at least 40% of the characters are masked for secrets of length 4 or more
if (secret.length <= 6) {
const first = secret[0] const first = secret[0]
const last = secret[secret.length - 1] const last = secret[secret.length - 1]
return `${first}***${last}` return `${first}***${last}`
} }
const prefix = secret.slice(0, Math.min(3, secret.length)) if (secret.length <= 12) {
const suffix = secret.slice(-Math.min(4, secret.length)) const firstTwo = secret.slice(0, 2)
return `${prefix}***${suffix}` const lastTwo = secret.slice(-2)
return `${firstTwo}****${lastTwo}`
}
const prefix = secret.slice(0, 3)
const suffix = secret.slice(-4)
return `${prefix}*****${suffix}`
} }