Browse Source

Revert "show warning for asset directory transversal to prepare for network api based reload in v5"

This reverts commit a720d1e2
Shelikhoo 4 years ago
parent
commit
916d3857a0

+ 0 - 9
common/platform/errors.generated.go

@@ -1,9 +0,0 @@
-package platform
-
-import "github.com/v2fly/v2ray-core/v4/common/errors"
-
-type errPathObjHolder struct{}
-
-func newError(values ...interface{}) *errors.Error {
-	return errors.New(values...).WithPathObj(errPathObjHolder{})
-}

+ 0 - 5
common/platform/others.go

@@ -7,7 +7,6 @@ import (
 	"io/fs"
 	"os"
 	"path/filepath"
-	"strings"
 )
 
 func ExpandEnv(s string) string {
@@ -26,10 +25,6 @@ func GetToolLocation(file string) string {
 
 // GetAssetLocation search for `file` in certain locations
 func GetAssetLocation(file string) string {
-	filepathCleaned := filepath.Clean(file)
-	if strings.HasPrefix("..", filepathCleaned) {
-		newError("directory transversal is not allowed for assets. This will be forbidden in v5.").AtWarning().WriteToLog()
-	}
 	const name = "v2ray.location.asset"
 	assetPath := NewEnvFlag(name).GetValue(getExecutableDir)
 	defPath := filepath.Join(assetPath, file)

+ 0 - 2
common/platform/platform.go

@@ -7,8 +7,6 @@ import (
 	"strings"
 )
 
-//go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen
-
 type EnvFlag struct {
 	Name    string
 	AltName string

+ 1 - 5
common/platform/windows.go

@@ -19,12 +19,8 @@ func GetToolLocation(file string) string {
 	return filepath.Join(toolPath, file+".exe")
 }
 
-// GetAssetLocation search for `file` in the executable dir
+// GetAssetLocation search for `file` in the excutable dir
 func GetAssetLocation(file string) string {
-	filepathCleaned := filepath.Clean(file)
-	if strings.HasPrefix("..", filepathCleaned) {
-		newError("directory transversal is not allowed for assets. This will be forbidden in v5.").AtWarning().WriteToLog()
-	}
 	const name = "v2ray.location.asset"
 	assetPath := NewEnvFlag(name).GetValue(getExecutableDir)
 	return filepath.Join(assetPath, file)