chore: bump version to 0.3.8

Code audit fixes:
- CRITICAL: reorder Markdown pipeline (fixImages before sanitize)
- CRITICAL: fix path prefix separator check
- BLOCKING: remove duplicate useEffect in Editor
- BLOCKING: skip onChange when content unchanged
- BLOCKING: optimize Sidebar re-render with useMemo
- HIGH: cleanup FileWatcher polling intervals
- HIGH: improve validatePath segment check
- HIGH: fix isExternalUpdate race with counter
- HIGH: add will-navigate / setWindowOpenHandler
- HIGH: explicit strip in sanitize schema
- MEDIUM: random temp file suffix instead of Date.now()
- MEDIUM/LOW: add IndexedDB error boundaries
- LOW: support UTF-16 BOM detection
This commit is contained in:
thzxx
2026-06-18 21:28:35 +08:00
parent dd78ff15a9
commit 7f070eb11d
13 changed files with 165 additions and 63 deletions
+5 -3
View File
@@ -10,9 +10,11 @@ function validatePath(filePath: string): boolean {
if (!filePath || typeof filePath !== 'string') return false
// 拒绝空字节
if (filePath.includes('\0')) return false
// 在 normalize 之前检查原始路径中的 .. 序列,防止 normalize 解析后绕过
// 例如 '/valid/path/../../etc/shadow' normalize 后变为 '/etc/shadow'.. 已消失
if (filePath.includes('..')) return false
// 检查路径遍历:以路径分隔符分割后检查是否存在完整'..' 段
// H-02: 用段检查替代全局 includes('..'),避免误伤含 '..' 的合法路径
const sepPattern = /[/\\]/
const parts = filePath.split(sepPattern)
if (parts.some(part => part === '..')) return false
// 必须是绝对路径
if (!isAbsolute(filePath)) return false
return true