Skip to content

Commit

Permalink
Set permissions on pulled blobs in storage to readonly.
Browse files Browse the repository at this point in the history
  • Loading branch information
amisevsk committed Jul 16, 2024
1 parent 2a3e41b commit cc597dc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/lib/repo/local/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ func (l *localRepo) resumeAndDownloadFile(desc ocispec.Descriptor, blob io.ReadS
if err := os.Rename(ingestFilename, blobPath); err != nil {
return fmt.Errorf("failed to move downloaded file into storage: %w", err)
}
if err := os.Chmod(blobPath, 0600); err != nil {
return fmt.Errorf("failed to set permissions on blob: %w", err)
}

return nil
}
Expand Down Expand Up @@ -211,6 +214,10 @@ func (l *localRepo) downloadFile(desc ocispec.Descriptor, blob io.ReadCloser, p
if err := os.Rename(ingestFilename, blobPath); err != nil {
return fmt.Errorf("failed to move downloaded file into storage: %w", err)
}
if err := os.Chmod(blobPath, 0600); err != nil {
return fmt.Errorf("failed to set permissions on blob: %w", err)
}

return nil
}

Expand Down

0 comments on commit cc597dc

Please sign in to comment.