尺子(棘轮): 用棘轮自己的正路收敛改动,只抬两条 SQL 记账分母
CatchSilenceRatchet 咬到三处,两处不该动它的数字: JwtService 的过期分支改 instanceof 分流(ExpiredJwtException 本就是 JwtException 子类 且 jj 先验签后查 exp)——catch 子句数回到 1,且带 [auth] jwt expired-but-signed 锚点, 否则「过期」与「伪造」在日志里又是同一个读数;容忍分支读库失败当场抛 401, 不吞异常,「不重抛」那一格因此不涨。登出那次不再 catch NumberFormatException, 改为先校验 subject 是数字。 只剩两条 SQL 分母是记账式抬升(XML 语句 96→97、select 66→67), 并把 countLiveWorkFor 登记成非迁移语句:它没有注解时代原文可对撞, 登记而不是让它红,是为了「谁新写了语句」留痕。
This commit is contained in:
@@ -160,11 +160,12 @@ public class AuthService {
|
||||
if (claims == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
logout(Long.parseLong(claims.getSubject()), DeviceSessionPolicy.claimDeviceId(claims));
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("[auth] 登出时 subject 不是数字,忽略");
|
||||
String subject = claims.getSubject();
|
||||
if (subject == null || !subject.chars().allMatch(c -> c >= '0' && c <= '9')) {
|
||||
log.warn("[auth] 登出时 subject 非数字,跳过吊销(cookie 仍由调用方清)");
|
||||
return;
|
||||
}
|
||||
logout(Long.parseLong(subject), DeviceSessionPolicy.claimDeviceId(claims));
|
||||
}
|
||||
|
||||
public LoginResultVo checkLogin(String token, String currentDeviceId) {
|
||||
|
||||
Reference in New Issue
Block a user