Skip to content

Commit 22c9e2e

Browse files
author
Paulo Gomes
authored
Merge pull request #818 from pjbgf/fs-perms
Decrease fs perms to 0o700
2 parents 0219905 + 60e46d1 commit 22c9e2e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

controllers/storage.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (s Storage) SetHostname(URL string) string {
112112
// MkdirAll calls os.MkdirAll for the given v1beta1.Artifact base dir.
113113
func (s *Storage) MkdirAll(artifact sourcev1.Artifact) error {
114114
dir := filepath.Dir(s.LocalPath(artifact))
115-
return os.MkdirAll(dir, 0o770)
115+
return os.MkdirAll(dir, 0o700)
116116
}
117117

118118
// RemoveAll calls os.RemoveAll for the given v1beta1.Artifact base dir.
@@ -432,7 +432,7 @@ func (s *Storage) Archive(artifact *sourcev1.Artifact, dir string, filter Archiv
432432
return err
433433
}
434434

435-
if err := os.Chmod(tmpName, 0o640); err != nil {
435+
if err := os.Chmod(tmpName, 0o600); err != nil {
436436
return err
437437
}
438438

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func mustInitStorage(path string, storageAdvAddr string, artifactRetentionTTL ti
342342
if path == "" {
343343
p, _ := os.Getwd()
344344
path = filepath.Join(p, "bin")
345-
os.MkdirAll(path, 0o770)
345+
os.MkdirAll(path, 0o700)
346346
}
347347

348348
storage, err := controllers.NewStorage(path, storageAdvAddr, artifactRetentionTTL, artifactRetentionRecords)

tests/fuzz/gitrepository_fuzzer.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func ensureDependencies() error {
120120
// Output all embedded testdata files
121121
embedDirs := []string{"testdata/crd", "testdata/certs"}
122122
for _, dir := range embedDirs {
123-
err := os.MkdirAll(dir, 0o750)
123+
err := os.MkdirAll(dir, 0o700)
124124
if err != nil {
125125
return fmt.Errorf("mkdir %s: %v", dir, err)
126126
}
@@ -139,7 +139,7 @@ func ensureDependencies() error {
139139
return fmt.Errorf("reading embedded file %s: %v", fileName, err)
140140
}
141141

142-
os.WriteFile(fileName, data, 0o640)
142+
os.WriteFile(fileName, data, 0o600)
143143
if err != nil {
144144
return fmt.Errorf("writing %s: %v", fileName, err)
145145
}
@@ -494,7 +494,7 @@ func createRandomFiles(f *fuzz.ConsumeFuzzer, fs billy.Filesystem, wt *git.Workt
494494
return errors.New("Dir contains '..'")
495495
}
496496

497-
err = fs.MkdirAll(dirPath, 0o770)
497+
err = fs.MkdirAll(dirPath, 0o700)
498498
if err != nil {
499499
return errors.New("Could not create the subDir")
500500
}

0 commit comments

Comments
 (0)