fix: 全维度审查修复(安全/正确性/性能/稳定性/客户端/前端)
安全 - /api/ziniao/** 五个匿名接口加管理员鉴权(此前可匿名换取任意员工店铺登录令牌) - 删除 Flask 遗留后门:默认密码建超管 + 每次启动写生产 users 表(服务端与客户端各一份) - 进度/详情接口归属过滤:新增 TaskProgressOwnershipSupport,11 模块 progress/light 与 /tasks/batch 接入,DTO 补 userId,前端 13 个查询封装补传(未传时后端不过滤,兼容旧端) - 代理提取链接(含账密)不再明文入日志(新增 common/util/SecretMasking) - 全局异常兜底不再回传原始异常信息;内部令牌比较改常量时间 - 登录加失败计数与锁定(10 次锁 15 分钟);品牌源文件下载加 SSRF 防护 - AdminApiGuardFilter 覆盖前缀从 2 扩到 15(开关默认 false,行为不变,为收紧做准备) - 生产关闭 springdoc/knife4j(/doc.html 匿名可读全部接口定义) 正确性 - 40901/40902 拆分:锁竞争不再被伪装成 success=true(此前客户端停止重试、分片静默丢失) - 假成功收敛:集采明细批量写失败改为抛出、去重 worker 异常标失败、4 个 worker 改判 success 字段、publish 空 ASIN 行参与批次 flush、巡店删除全失败带 error 上报 - 客户端心跳 discard 移入 finally(7 模块,失败路径不再留僵尸 RUNNING 任务) - 状态机条件更新:跟价停止循环、集采 activate/fail、imagevideo 归档回填、店铺匹配提交 性能 - 前端入口包 JS 1.05MB→204KB、CSS 355KB→10.7KB(Element Plus 改按需 + el-config-provider) - 载荷引用计数按指针里的 taskId 收敛(原 JSON 列 IN 全表扫且逐行调用) - 店铺明细多值批量 INSERT;快照 upsert 预载缓存;结果文件列改单条 UPDATE - 新增迁移 V120(补 3 个缺失索引)/V121(删 4 个被覆盖的冗余索引)/V122(URL 前缀索引) 稳定性 - 新增 common/util/ThreadPools 有界线程池替换 5 处无界队列(防堆积 OOM) - Redis 锁释放改 Lua 原子校验(原裸 delete 会误删他人已过期的锁) - imagevideo 加死节点接管;锁续期失败重试;调度池 4→16;openStream 全部加超时 - 事务内远程对象删除移到提交后;启动恢复锁按实例命名 客户端 - 不再 taskkill /f /im chrome.exe(改为按调试端口精准回收,不杀用户自己的浏览器) - 密码检测不再无条件杀紫鸟进程;品牌检测加全局互斥(代理池不再互相覆盖) - base_dir 统一到 exe 目录(原被 os.getcwd() 覆盖,日志/缓存会分裂两个目录) - 缓存加定时清理;图片下载加超时;mkstemp 句柄托管 测试 - 同步更新受影响的契约测试(构造器签名/条件更新/方法改名/新增接口方法等) - 修复 FaultInjectionTest 等 3 处 mock 未 stub 流式 read 导致的读循环 OOM - mvn test 2795 个测试全绿
This commit is contained in:
@@ -156,7 +156,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -181,7 +181,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -205,7 +205,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
@@ -268,9 +272,13 @@ export function getDeleteBrandTaskDetail(taskId: number) {
|
||||
|
||||
export function getDeleteBrandTaskDetails(taskIds: number[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<DeleteBrandTaskBatchVo>, { taskIds: number[] }>(
|
||||
post<JavaApiResponse<DeleteBrandTaskBatchVo>, { taskIds: number[]; userId?: number }>(
|
||||
buildJavaUrl(API_ENDPOINTS.deleteBrand.taskDetails),
|
||||
{ taskIds },
|
||||
{
|
||||
taskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -121,9 +121,39 @@ async function fetchAppColumnPermissions() {
|
||||
return items
|
||||
}
|
||||
|
||||
/**
|
||||
* 列权限键的内存缓存与 in-flight 合并(2026-09 全维度审查补):
|
||||
* 同一路由内多个组件各自 onMounted 调用(如 AmazonConsolePage + AmazonTopBar),
|
||||
* 此前每次进页面都发两次相同请求;TTL 取 10s,既消掉重复又保证权限变更能较快生效。
|
||||
*/
|
||||
const APP_COLUMN_KEYS_TTL_MS = 10_000
|
||||
let appColumnKeysCache: { value: string[]; at: number } | null = null
|
||||
let appColumnKeysInflight: Promise<string[]> | null = null
|
||||
|
||||
/** 归一化后的列权限键(菜单入口/卡片显隐用,见 AmazonConsolePage 等) */
|
||||
export async function getCurrentUserAppColumnKeys() {
|
||||
return normalizeColumnKeys(await fetchAppColumnPermissions())
|
||||
const now = Date.now()
|
||||
if (appColumnKeysCache && now - appColumnKeysCache.at < APP_COLUMN_KEYS_TTL_MS) {
|
||||
return appColumnKeysCache.value
|
||||
}
|
||||
if (appColumnKeysInflight) {
|
||||
return appColumnKeysInflight
|
||||
}
|
||||
appColumnKeysInflight = (async () => {
|
||||
try {
|
||||
const keys = normalizeColumnKeys(await fetchAppColumnPermissions())
|
||||
appColumnKeysCache = { value: keys, at: Date.now() }
|
||||
return keys
|
||||
} finally {
|
||||
appColumnKeysInflight = null
|
||||
}
|
||||
})()
|
||||
return appColumnKeysInflight
|
||||
}
|
||||
|
||||
/** 失效列权限缓存(权限变更后需要立即生效时调用)。 */
|
||||
export function invalidateAppColumnKeysCache() {
|
||||
appColumnKeysCache = null
|
||||
}
|
||||
|
||||
/** 原始权限菜单项(页面需要自行计算权限状态时用,见 DesktopHomePage) */
|
||||
|
||||
@@ -238,7 +238,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
@@ -340,9 +344,13 @@ export function deletePriceTrackTask(taskId: number) {
|
||||
|
||||
export function getPriceTrackTasksBatch(taskIds: number[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<PriceTrackTaskBatchVo>, { taskIds: number[] }>(
|
||||
post<JavaApiResponse<PriceTrackTaskBatchVo>, { taskIds: number[]; userId?: number }>(
|
||||
`${JAVA_API_PREFIX}/price-track/tasks/batch`,
|
||||
{ taskIds },
|
||||
{
|
||||
taskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -238,9 +238,11 @@ export function getPublishTaskProgressBatch(taskIds: number[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
JavaApiResponse<PublishTaskBatchVo>,
|
||||
{ task_ids: number[] }
|
||||
{ task_ids: number[]; user_id?: number }
|
||||
>(buildJavaUrl(API_ENDPOINTS.publish.progressBatch), {
|
||||
task_ids: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
user_id: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, { timeout: getTaskProgressTimeoutMs() }),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -197,7 +197,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -232,7 +232,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
@@ -386,9 +390,13 @@ export function deletePendingProductRiskShopResult(shopName: string) {
|
||||
|
||||
export function getProductRiskTasksBatch(taskIds: number[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<ProductRiskTaskBatchVo>, { taskIds: number[] }>(
|
||||
post<JavaApiResponse<ProductRiskTaskBatchVo>, { taskIds: number[]; userId?: number }>(
|
||||
`${JAVA_API_PREFIX}/product-risk-resolve/tasks/batch`,
|
||||
{ taskIds },
|
||||
{
|
||||
taskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -548,9 +556,13 @@ export function completeShopMatchTaskStage(taskId: number, stageIndex: number) {
|
||||
|
||||
export function getShopMatchTasksBatch(taskIds: number[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<ShopMatchTaskBatchVo>, { taskIds: number[] }>(
|
||||
post<JavaApiResponse<ShopMatchTaskBatchVo>, { taskIds: number[]; userId?: number }>(
|
||||
`${JAVA_API_PREFIX}/shop-match/tasks/batch`,
|
||||
{ taskIds },
|
||||
{
|
||||
taskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -206,7 +206,11 @@ async function postTaskProgressBatch<T>(
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[] }>(path, { taskIds: normalizedTaskIds }, {
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user