From 2197d8295708afaaa92d685b10e7a2a660594b33 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 9 Nov 2020 16:58:01 -0700 Subject: [PATCH] Clean paths from AllowedMounts to ensure consistency --- server/mounts.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/mounts.go b/server/mounts.go index c77ecc9..2a23a2a 100644 --- a/server/mounts.go +++ b/server/mounts.go @@ -49,7 +49,9 @@ func (s *Server) customMounts() []environment.Mount { mounted := false for _, allowed := range config.Get().AllowedMounts { - if !strings.HasPrefix(source, allowed) { + // Check if the source path is included in the allowed mounts list. + // filepath.Clean will strip all trailing slashes (unless the path is a root directory). + if !strings.HasPrefix(source, filepath.Clean(allowed)) { continue }