@@ -117,7 +117,7 @@ func createSQLiteBackup(sourcePath, destPath string) error {
117117 // Ensure parent directory exists for destination
118118 destDir := filepath .Dir (destPath )
119119 if destDir != "" && destDir != "." {
120- if err := os .MkdirAll (destDir , 0755 ); err != nil {
120+ if err := os .MkdirAll (destDir , 0750 ); err != nil {
121121 return fmt .Errorf ("failed to create destination directory: %w" , err )
122122 }
123123 }
@@ -176,7 +176,7 @@ func restoreSQLiteBackup(sourcePath, destPath string) error {
176176 // Ensure parent directory exists for destination
177177 destDir := filepath .Dir (destPath )
178178 if destDir != "" && destDir != "." {
179- if err := os .MkdirAll (destDir , 0755 ); err != nil {
179+ if err := os .MkdirAll (destDir , 0750 ); err != nil {
180180 return fmt .Errorf ("failed to create destination directory: %w" , err )
181181 }
182182 }
@@ -239,7 +239,7 @@ func restoreSQLiteBackup(sourcePath, destPath string) error {
239239// copyFile copies a file from src to dst using simple file copy.
240240// This is kept as a fallback method if SQLite native backup fails.
241241func copyFile (src , dst string ) error {
242- source , err := os .Open (src )
242+ source , err := os .Open (src ) // #nosec G304
243243 if err != nil {
244244 return fmt .Errorf ("failed to open source file: %w" , err )
245245 }
@@ -252,7 +252,7 @@ func copyFile(src, dst string) error {
252252 }
253253
254254 // Create destination file
255- destination , err := os .Create (dst )
255+ destination , err := os .Create (dst ) // #nosec G304
256256 if err != nil {
257257 return fmt .Errorf ("failed to create destination file: %w" , err )
258258 }
@@ -286,13 +286,13 @@ func CreateBackup(dbPath string, config *BackupConfig) (string, error) {
286286
287287 // Ensure directory exists
288288 dir := filepath .Dir (dbPath )
289- if err := os .MkdirAll (dir , 0755 ); err != nil {
289+ if err := os .MkdirAll (dir , 0750 ); err != nil {
290290 return "" , fmt .Errorf ("failed to create directory: %w" , err )
291291 }
292292
293293 // Ensure backups subdirectory exists
294294 backupsDir := filepath .Join (dir , "backups" )
295- if err := os .MkdirAll (backupsDir , 0755 ); err != nil {
295+ if err := os .MkdirAll (backupsDir , 0750 ); err != nil {
296296 return "" , fmt .Errorf ("failed to create backups directory: %w" , err )
297297 }
298298
@@ -334,7 +334,7 @@ func RestoreBackup(backupPath string, targetPath string) error {
334334
335335 // Ensure target directory exists
336336 targetDir := filepath .Dir (targetPath )
337- if err := os .MkdirAll (targetDir , 0755 ); err != nil {
337+ if err := os .MkdirAll (targetDir , 0750 ); err != nil {
338338 return fmt .Errorf ("failed to create target directory: %w" , err )
339339 }
340340
0 commit comments