app接线: 上传去重响应/已存附件删除/缩略图白名单对齐后端 (tsk_sTHRFtFoHf-G)
- createTask 消费后端去重后的权威 attachments 列表,按入库数报数并提示去重数
- 附件删除 toast 语义由 warn 调整为 ok(attDeleted 为成功语义)
- TaskDetail 缩略图 isImg 收敛到 KIT_ATT_SAFE_INLINE 硬白名单(png/jpeg/gif/webp),
与后端 src/api/server.ts SAFE_INLINE 一字不差,svg/html 不走 <img src=服务端URL> inline,
钉死同源存储型 XSS
- i18n 新增 attUploaded/attDeduped 两个带 {n} 占位的 key,覆盖 zh/en/es/ja/fr
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,10 @@ const KIT_STATUS_ORDER = [
|
||||
];
|
||||
const KIT_CPLX_OPTS = [{ value: 'hard', label: 'HARD' }, { value: 'medium', label: 'MED' }, { value: 'easy', label: 'EASY' }];
|
||||
const KIT_PRIO_OPTS = [{ value: 'P0', label: 'P0' }, { value: 'P1', label: 'P1' }, { value: 'P2', label: 'P2' }];
|
||||
// 与后端 src/api/server.ts 的 SAFE_INLINE 一字不差:只有这些类型后端才 inline 回原图,
|
||||
// 其余(尤其 image/svg+xml、text/html)强制 attachment+octet-stream 下载。前端缩略图必须对齐同一硬白名单,
|
||||
// 否则对 svg 用 <img src=服务端URL> 会拿到 octet-stream 出坏图,且策略漂移时埋同源存储型 XSS 隐患。
|
||||
const KIT_ATT_SAFE_INLINE = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);
|
||||
|
||||
// 主显示区各区块标题通用折叠按钮(▾ 展开 / ▸ 折叠);暴露到 window 供 Agent/审批闸/归档复用
|
||||
function KitFoldBtn({ folded, onClick, t }) {
|
||||
@@ -292,7 +296,7 @@ function TaskDetail({ task, t, byId, onJump, onTakeover, taskOps }) {
|
||||
<div className="m-nt-grid">
|
||||
{attachments.map((a) => {
|
||||
const dn = attDiskName(a);
|
||||
const isImg = (a.type || '').startsWith('image/');
|
||||
const isImg = KIT_ATT_SAFE_INLINE.has(a.type || '');
|
||||
const url = attUrl(task.id, dn);
|
||||
return (
|
||||
<div key={dn || a.name} className="m-nt-chip">
|
||||
|
||||
Reference in New Issue
Block a user