🔴 [H4] 缓存指纹太弱 → 中间修改检测不到 #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
文件:
core/io/index_cache.rs:63分类: 缓存一致性
问题: 文件指纹仅 hash 前 4KB + 后 4KB + 文件大小。文件中间部分被修改但大小/head/tail 不变时,会命中过期缓存。
建议修复: 加入 mtime/inode,小文件全文件 hash,大文件分块 rolling hash。
审核结论:关闭(风险极低)
技术缺陷确认属实:
compute_file_hash(core/io/index_cache.rs:63)确实只采样 head 4KB + tail 4KB + file_size,中间区域不参与指纹计算。但实际风险极低:
如需加强:加 mtime 即可,无需 rolling hash。
Close as wontfix / low-risk.