From 9c6b6f3b0f47fff63e4a567afc788b8fcd6cd385 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 26 Nov 2024 13:52:57 -0500 Subject: [PATCH] [2.10] Avoid permissions errors on Windows (#401) --- config/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/config.go b/config/config.go index c6200d7c..c8b7f919 100644 --- a/config/config.go +++ b/config/config.go @@ -7,6 +7,7 @@ import ( "net/url" "os" "path/filepath" + "runtime" "strings" "github.com/sirupsen/logrus" @@ -68,6 +69,13 @@ func LoadFromPath(path string) (Config, error) { // We want this because configuration may have sensitive information (eg: creds). // A nil error is returned if the file doesn't exist. func GetFilePermissionWarnings(path string) ([]string, error) { + // Permission bits on Windows are not representative + // of the actual ACLs set for a given file. As the owner + // bit is always used for all three bits on Windows, this check + // will always fail, even if the file has restricted access to admins only. + if runtime.GOOS == "windows" { + return nil, nil + } info, err := os.Stat(path) if err != nil { if os.IsNotExist(err) {