mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-24 07:55:06 +03:00
Remove checks for absolute paths in validateConfigPath function to simplify path validation logic. This change streamlines the configuration handling process by eliminating unnecessary restrictions on system directory access.
This commit is contained in:
parent
2180e12b73
commit
09f600c6cf
1 changed files with 0 additions and 10 deletions
|
@ -314,16 +314,6 @@ func validateConfigPath(path string) (string, error) {
|
|||
return "", fmt.Errorf("invalid path: contains path traversal sequences")
|
||||
}
|
||||
|
||||
// Check for absolute paths starting with suspicious patterns
|
||||
if strings.HasPrefix(path, "/etc/") || strings.HasPrefix(path, "/root/") ||
|
||||
strings.HasPrefix(path, "/var/") || strings.HasPrefix(path, "/sys/") ||
|
||||
strings.HasPrefix(path, "/proc/") || strings.HasPrefix(path, "/dev/") {
|
||||
// Allow only specific safe paths
|
||||
if !strings.HasPrefix(path, "/etc/yggdrasil/") && !strings.HasPrefix(path, "/var/lib/yggdrasil/") {
|
||||
return "", fmt.Errorf("access to system directories not allowed")
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the path to resolve any ".." or "." components
|
||||
cleanPath := filepath.Clean(path)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue