MCPcopy
hub / github.com/perkeep/perkeep / checkKeyFilePermissions

Function checkKeyFilePermissions

pkg/blobserver/encrypt/permissions_posix.go:26–33  ·  view source on GitHub ↗
(keyFile string)

Source from the content-addressed store, hash-verified

24)
25
26func checkKeyFilePermissions(keyFile string) error {
27 if fileInfo, err := os.Stat(keyFile); err != nil {
28 return fmt.Errorf("Checking for key file permissions %v: %v", keyFile, err)
29 } else if fileInfo.Mode().Perm()&0077 != 0 {
30 return fmt.Errorf("Key file permissions are too permissive (%o), they should be 600", fileInfo.Mode().Perm())
31 }
32 return nil
33}

Callers 1

readKeyFileFunction · 0.70

Calls 2

ModeMethod · 0.80
StatMethod · 0.65

Tested by

no test coverage detected