|
|
|
@ -363,6 +363,7 @@ public class CryptoSensitiveHsmServiceImpl implements ICryptoSensitiveHsmService |
|
|
|
int passed = 0; |
|
|
|
int tampered = 0; |
|
|
|
int skipped = 0; |
|
|
|
int errored = 0; |
|
|
|
long pageSize = 500L; |
|
|
|
Page<CryptoIntegrityData> page = new Page<>(1, pageSize); |
|
|
|
LambdaQueryWrapper<CryptoIntegrityData> lqw = new LambdaQueryWrapper<CryptoIntegrityData>() |
|
|
|
@ -395,13 +396,14 @@ public class CryptoSensitiveHsmServiceImpl implements ICryptoSensitiveHsmService |
|
|
|
cryptoIntegrityDataMapper.updateById(record); |
|
|
|
processed++; |
|
|
|
} catch (Exception e) { |
|
|
|
// 修复: 校验异常(如 bizId 非数字/不支持字段)不再静默滞留, 标记失败态脱离"永不校验"盲区
|
|
|
|
log.error("完整性校验异常, 标记为校验失败, tableName={}, bizId={}", |
|
|
|
// 修复: 校验异常(如 bizId 非数字/不支持字段)标记独立状态 4, 与"确认篡改"(2)区分,
|
|
|
|
// 避免程序缺陷被误统计为篡改告警噪音; 数据状态未知, 代码修复后允许重建基线
|
|
|
|
log.error("完整性校验异常, 标记为校验异常(非篡改), tableName={}, bizId={}", |
|
|
|
record.getTableName(), record.getBizId(), e); |
|
|
|
record.setVerifyResult(2); |
|
|
|
record.setVerifyResult(4); |
|
|
|
record.setLastVerifyTime(new Date()); |
|
|
|
cryptoIntegrityDataMapper.updateById(record); |
|
|
|
tampered++; |
|
|
|
errored++; |
|
|
|
processed++; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -412,11 +414,15 @@ public class CryptoSensitiveHsmServiceImpl implements ICryptoSensitiveHsmService |
|
|
|
} |
|
|
|
// 修复: 发现异常记录时升级为 error 告警, 不再仅 info 汇总
|
|
|
|
if (tampered > 0) { |
|
|
|
log.error("完整性校验发现异常记录, tableName={}, 异常数={}(含篡改与校验失败, 须人工核查)", tableName, tampered); |
|
|
|
log.error("完整性校验发现疑似篡改记录, tableName={}, 篡改数={}(须人工核查, 基线已锁定拒绝自动覆盖)", tableName, tampered); |
|
|
|
} |
|
|
|
log.info("完整性校验完成, tableName={}, 处理={}, 通过={}, 篡改/异常={}, 跳过(数据不存在)={}", |
|
|
|
tableName, processed, passed, tampered, skipped); |
|
|
|
if (errored > 0) { |
|
|
|
log.warn("完整性校验存在校验异常记录, tableName={}, 异常数={}(程序缺陷或脏数据, 须排查代码, 非篡改)", tableName, errored); |
|
|
|
} |
|
|
|
log.info("完整性校验完成, tableName={}, 处理={}, 通过={}, 篡改={}, 校验异常={}, 跳过(数据不存在)={}", |
|
|
|
tableName, processed, passed, tampered, errored, skipped); |
|
|
|
return processed; |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
log.error("数据完整性校验失败, tableName={}", tableName, e); |
|
|
|
} |
|
|
|
|