aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2023-05-11 18:57:23 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2023-05-11 18:57:23 +0200
commit68d6aafae84de72563199f80e3906bfbad3cd6c5 (patch)
tree33f7fb75c474936c53b4ec794a96eb939dcecf9a
parent95f6848fac1cce0466709113b3464589dfc5dcfd (diff)
downloadfeed2imap-go-68d6aafae84de72563199f80e3906bfbad3cd6c5.tar.gz
feed2imap-go-68d6aafae84de72563199f80e3906bfbad3cd6c5.tar.bz2
feed2imap-go-68d6aafae84de72563199f80e3906bfbad3cd6c5.zip
Issue #95: Change cache ownership.
There is no need for the cache to be accessible by anyone who is not us. Thus enforce the cache to be stored with 0600.
Diffstat (limited to '')
-rw-r--r--internal/feed/cache/cache.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/feed/cache/cache.go b/internal/feed/cache/cache.go
index d13ae9a..0e8dd80 100644
--- a/internal/feed/cache/cache.go
+++ b/internal/feed/cache/cache.go
@@ -103,6 +103,10 @@ func (cache *Cache) store(fileName string) error {
}
defer f.Close()
+ if err = os.Chmod(fileName, 0600); err != nil {
+ return fmt.Errorf("changing access rights of '%s': %w", fileName, err)
+ }
+
writer := bufio.NewWriter(f)
if err = writer.WriteByte(byte(currentVersion)); err != nil {
return fmt.Errorf("writing to '%s': %w", fileName, err)