From 68d6aafae84de72563199f80e3906bfbad3cd6c5 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 11 May 2023 18:57:23 +0200 Subject: 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. --- internal/feed/cache/cache.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/feed/cache') 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) -- cgit v1.2.3-70-g09d2