fix: 修复后端竞态/安全/数据处理问题并移除冗余 outImage 列

首次激活改条件更新消除并发竞态;备份恢复补模型全集与版本校验防清库;
审核列表分页总数、操作日志未捕获 Promise、出库导入重复码、加密密钥可编辑、
溯源码盐以 env 为准、证书按 originKey reconcile、env 加载去重等修复;
新增 parseBigId 防非法入参 500、全局安全响应头、去除 SVG 上传、接入 throttler 限流、
入队失败补偿、hashData 稳定序列化、无效码负缓存、看板已激活口径调整;
移除冗余 TraceCode.outImage 列统一 outImages(迁移 drop_trace_code_out_image)。
This commit is contained in:
Nixevol
2026-07-09 13:14:26 +08:00
parent c39974e72d
commit f712b16c1f
29 changed files with 328 additions and 170 deletions
@@ -1,4 +1,4 @@
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { CallHandler, ExecutionContext, Injectable, Logger, NestInterceptor } from '@nestjs/common';
import { Request } from 'express';
import { Observable, throwError } from 'rxjs';
import { catchError, tap } from 'rxjs/operators';
@@ -79,8 +79,15 @@ function shouldLog(method: string, path: string): boolean {
@Injectable()
export class OperationLogInterceptor implements NestInterceptor {
private readonly logger = new Logger(OperationLogInterceptor.name);
constructor(private readonly logs: OperationLogService) {}
private write(data: Parameters<OperationLogService['create']>[0]): void {
// 操作日志写入失败不应影响主流程,也不能抛未捕获 Promise
this.logs.create(data).catch((e) => this.logger.warn(`操作日志写入失败:${(e as Error).message}`));
}
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
const req = context.switchToHttp().getRequest<Request & { user?: AuthUser }>();
const method = req.method.toUpperCase();
@@ -105,14 +112,14 @@ export class OperationLogInterceptor implements NestInterceptor {
return next.handle().pipe(
tap(() => {
void this.logs.create({
this.write({
...base,
status: 'SUCCESS',
durationMs: Date.now() - started,
});
}),
catchError((err) => {
void this.logs.create({
this.write({
...base,
status: 'FAILED',
message: (err as Error)?.message || String(err),