mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-28 06:25:00 +00:00
fix: reduce chmod permissions for created files and directories (#2137)
quiet more security scanner issues: pass one of chmod restriction to remove group and other permissions Signed-off-by: Dave Lee <dave@gray101.com>
This commit is contained in:
parent
365ef92530
commit
c8dd8e5ef4
15 changed files with 36 additions and 35 deletions
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
func ExtractFiles(content embed.FS, extractDir string) error {
|
||||
// Create the target directory if it doesn't exist
|
||||
err := os.MkdirAll(extractDir, 0755)
|
||||
err := os.MkdirAll(extractDir, 0750)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create directory: %v", err)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func ExtractFiles(content embed.FS, extractDir string) error {
|
|||
targetFile := filepath.Join(extractDir, path)
|
||||
if d.IsDir() {
|
||||
// Create the directory in the target directory
|
||||
err := os.MkdirAll(targetFile, 0755)
|
||||
err := os.MkdirAll(targetFile, 0750)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create directory: %v", err)
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func ExtractFiles(content embed.FS, extractDir string) error {
|
|||
}
|
||||
|
||||
// Create the file in the target directory
|
||||
err = os.WriteFile(targetFile, fileData, 0644)
|
||||
err = os.WriteFile(targetFile, fileData, 0600)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to write file: %v", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue