update at 2026-03-03 21:19:52

This commit is contained in:
douboer@gmail.com
2026-03-03 21:19:52 +08:00
parent 3dc4144007
commit e4987a2d77
139 changed files with 21522 additions and 43 deletions

View File

@@ -0,0 +1,15 @@
/**
* 日志脱敏函数,避免导出文本泄露密码和主机信息。
*/
export function maskSensitive(value: string): string {
return String(value)
.replace(/([0-9]{1,3}\.){3}[0-9]{1,3}/g, "***.***.***.***")
.replace(/(token|password|passphrase|secret)\s*[=:]\s*[^\s]+/gi, "$1=***")
.replace(/~\/.+?(?=\s|$)/g, "~/***");
}
export function maskHost(host: string): string {
return String(host)
.replace(/([a-zA-Z0-9._%+-]+)@/, "***@")
.replace(/([0-9]{1,3}\.){3}[0-9]{1,3}/, "***.***.***.***");
}