Files
config/ownership_unix.go
T
2026-09-28 16:55:58 -04:00

18 lines
310 B
Go

//go:build unix
package config
import (
"fmt"
"os"
"syscall"
)
func checkFileOwner(info os.FileInfo) error {
stat, ok := info.Sys().(*syscall.Stat_t)
if !ok || stat.Uid != uint32(os.Geteuid()) {
return wrapError(ErrFileAccess, fmt.Errorf("config file is not owned by current user"))
}
return nil
}