Skip to content

Commit 3416c4e

Browse files
committed
restrict file permissions
Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
1 parent 45655fd commit 3416c4e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pkg/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ filter:
173173

174174
// Create test config file
175175
configPath := filepath.Join(tmpDir, "config.yaml")
176-
err := os.WriteFile(configPath, []byte(tt.yamlContent), 0644)
176+
err := os.WriteFile(configPath, []byte(tt.yamlContent), 0600)
177177
require.NoError(t, err)
178178

179179
// Load the config
@@ -229,7 +229,7 @@ filter:
229229
include: ["prod", "stable"]
230230
exclude: ["beta", "alpha"]`
231231

232-
err := os.WriteFile(configPath, []byte(yamlContent), 0644)
232+
err := os.WriteFile(configPath, []byte(yamlContent), 0600)
233233
require.NoError(t, err)
234234

235235
// Load it back

pkg/sources/storage_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (f *FileStorageManager) Store(ctx context.Context, config *config.Config, r
6464

6565
// Write to temporary file first for atomic operation
6666
tempPath := filePath + ".tmp"
67-
if err := os.WriteFile(tempPath, data, 0644); err != nil {
67+
if err := os.WriteFile(tempPath, data, 0600); err != nil {
6868
return fmt.Errorf("failed to write temporary registry file: %w", err)
6969
}
7070

pkg/status/persistence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (f *FileStatusPersistence) SaveStatus(ctx context.Context, status *SyncStat
5151

5252
// Write to temporary file first for atomic operation
5353
tempPath := f.filePath + ".tmp"
54-
if err := os.WriteFile(tempPath, data, 0644); err != nil {
54+
if err := os.WriteFile(tempPath, data, 0600); err != nil {
5555
return fmt.Errorf("failed to write temporary status file: %w", err)
5656
}
5757

0 commit comments

Comments
 (0)