File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,12 @@ func (cfg *UpdaterConfig) EnsurePathsExist() error {
8484 }
8585
8686 for _ , path := range []string {cfg .LocalMetadataDir , cfg .LocalTargetsDir } {
87- if err := os .MkdirAll (path , os .ModePerm ); err != nil {
87+ // Use 0700 for cache directories: only the owner can read, write, and
88+ // access the directory. This prevents other users on shared systems from
89+ // reading or writing to the TUF cache, which could be a security risk.
90+ // If different permissions are needed, pre-create the directories with
91+ // the desired permissions before calling this function.
92+ if err := os .MkdirAll (path , 0700 ); err != nil {
8893 return err
8994 }
9095 }
Original file line number Diff line number Diff line change @@ -351,7 +351,12 @@ func (cfg *MultiRepoConfig) EnsurePathsExist() error {
351351 return nil
352352 }
353353 for _ , path := range []string {cfg .LocalMetadataDir , cfg .LocalTargetsDir } {
354- err := os .MkdirAll (path , os .ModePerm )
354+ // Use 0700 for cache directories: only the owner can read, write, and
355+ // access the directory. This prevents other users on shared systems from
356+ // reading or writing to the TUF cache, which could be a security risk.
357+ // If different permissions are needed, pre-create the directories with
358+ // the desired permissions before calling this function.
359+ err := os .MkdirAll (path , 0700 )
355360 if err != nil {
356361 return err
357362 }
You can’t perform that action at this time.
0 commit comments