fix: add path safety check in file type providers (#2177)

This commit is contained in:
白日梦主义
2025-07-22 21:37:54 +08:00
committed by GitHub
parent d4fbffd8e8
commit b06ec5bef8
2 changed files with 6 additions and 0 deletions

View File

@@ -108,6 +108,9 @@ func ParseProxyProvider(name string, mapping map[string]any) (types.ProxyProvide
switch schema.Type {
case "file":
path := C.Path.Resolve(schema.Path)
if !C.Path.IsSafePath(path) {
return nil, C.Path.ErrNotSafePath(path)
}
vehicle = resource.NewFileVehicle(path)
case "http":
path := C.Path.GetPathByHash("proxies", schema.URL)