open-vault/vault/diagnose/file_checks_unix.go
akshya96 796003ddda
Vault 3992 ToB Config and Plugins Permissions (#14817)
* updating changes from ent PR

* adding changelog

* fixing err

* fixing semgrep error
2022-04-04 09:45:41 -07:00

21 lines
323 B
Go

//go:build !windows
package diagnose
import (
"io/fs"
"github.com/hashicorp/vault/helper/osutil"
)
// IsOwnedByRoot checks if a file is owned by root
func IsOwnedByRoot(info fs.FileInfo) bool {
if !osutil.FileUIDEqual(info, 0) {
return false
}
if !osutil.FileGIDEqual(info, 0) {
return false
}
return true
}