fix: 2FA二维码token回退裸hex64,查询参数名保留token(WAF矩阵验证v1_前缀与t=长hex被拦)

This commit is contained in:
ypsdf1
2026-10-01 10:46:34 +08:00
parent 1eb898adea
commit 2e4ddcbaea
2 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -49,10 +49,11 @@ function twofaRequireSecret() {
}
}
/** token 形态:v1_ 前缀 + 64 位十六进制(Java SecureRandom 256bit)。
* 前缀不是装饰:线上 WAF 会拦「查询参数=32位以上纯hex」形态,实测带前缀可过。 */
/** token 形态:64 位十六进制(Java SecureRandom 256bit)。
* 查询参数名必须用 token 不能用 t:线上源站WAF拦「t=<32+位hex>」与「token=v1_*」形态,
* 「token=<裸hex>」实测可过(2026-10-01 矩阵验证)。 */
function twofaValidToken($t) {
return is_string($t) && preg_match('/^v1_[a-f0-9]{32,128}$/', $t) === 1;
return is_string($t) && preg_match('/^[a-f0-9]{32,128}$/', $t) === 1;
}
$action = getParam('action', '');