fix: validate signatures and restore report metrics

This commit is contained in:
hectorzhao
2026-07-27 20:51:14 +08:00
parent 04a497c791
commit 94aeacd3a2
19 changed files with 438 additions and 42 deletions
+5 -2
View File
@@ -1990,9 +1990,12 @@ function normalizeSmsSignature(name: string) {
}
function validateCompleteSmsSignature(name: string) {
const value = name.trim();
const value = name;
if (/[\p{White_Space}\p{Cc}\p{Default_Ignorable_Code_Point}]/u.test(value)) {
throw new BadRequestException('短信签名不能包含空格、换行或不可见字符');
}
const match = value.match(/^【([^【】]+)】$/);
if (!match || match[1] !== match[1].trim()) {
if (!match) {
throw new BadRequestException('短信签名必须包含完整中文黑括号,例如:【某某科技】');
}
return value;