Fix path normalization in safePath function
This commit is contained in:
parent
c081785d37
commit
e17580c366
|
|
@ -9,8 +9,9 @@ import type { Child } from 'hono/jsx'
|
|||
const APPS_DIR = process.env.APPS_DIR!
|
||||
|
||||
const safePath = (base: string, ...segments: string[]) => {
|
||||
const full = resolve(base, ...segments)
|
||||
if (!full.startsWith(base + '/') && full !== base) return null
|
||||
const norm = resolve(base)
|
||||
const full = resolve(norm, ...segments)
|
||||
if (!full.startsWith(norm + '/') && full !== norm) return null
|
||||
return full
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user