From 09f600c6cf90dbd76eabe5e5840c8f4a64527e31 Mon Sep 17 00:00:00 2001 From: Andy Oknen Date: Fri, 15 Aug 2025 20:21:54 +0000 Subject: [PATCH] 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. --- src/config/config.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/config/config.go b/src/config/config.go index 1da49b96..7bef506b 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -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)