aboutsummaryrefslogtreecommitdiff
path: root/pkg/config
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkg/config/config.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index a7c540f..0d2c944 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -125,6 +125,17 @@ func Load(path string) (*Config, error) {
return nil, fmt.Errorf("while opening '%s': %w", path, err)
}
+ defer f.Close()
+
+ stat, err := f.Stat()
+ if err != nil {
+ return nil, fmt.Errorf("while getting stats of '%s': %w", path, err)
+ }
+
+ if stat.Mode().Perm()&0004 != 0 {
+ log.Warnf("Config file '%s' can be read by anyone. As this contains your IMAP credentials, you are advised to remove global read access.", path)
+ }
+
cfg := WithDefault()
if err = cfg.parse(f); err != nil {
return nil, fmt.Errorf("while parsing: %w", err)