Skip to content

Commit 09f600c

Browse files
committed
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.
1 parent 2180e12 commit 09f600c

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

src/config/config.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,6 @@ func validateConfigPath(path string) (string, error) {
314314
return "", fmt.Errorf("invalid path: contains path traversal sequences")
315315
}
316316

317-
// Check for absolute paths starting with suspicious patterns
318-
if strings.HasPrefix(path, "/etc/") || strings.HasPrefix(path, "/root/") ||
319-
strings.HasPrefix(path, "/var/") || strings.HasPrefix(path, "/sys/") ||
320-
strings.HasPrefix(path, "/proc/") || strings.HasPrefix(path, "/dev/") {
321-
// Allow only specific safe paths
322-
if !strings.HasPrefix(path, "/etc/yggdrasil/") && !strings.HasPrefix(path, "/var/lib/yggdrasil/") {
323-
return "", fmt.Errorf("access to system directories not allowed")
324-
}
325-
}
326-
327317
// Clean the path to resolve any ".." or "." components
328318
cleanPath := filepath.Clean(path)
329319

0 commit comments

Comments
 (0)