security: Update go-uuid and mholt/archiver to recommended version (#2216)
* security: Update go-uuid to recommended version * security: Update mholt/archiver dep to recommended version Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -160,7 +160,11 @@ func CreatePackage(input cli.Input, client client.Interface, pkgName string, pkg
|
||||
}
|
||||
|
||||
if len(pkgName) == 0 {
|
||||
pkgName = strings.ToLower(uuid.NewV4().String())
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error generating UUID")
|
||||
}
|
||||
pkgName = strings.ToLower(id.String())
|
||||
}
|
||||
|
||||
pkg := &fv1.Package{
|
||||
|
||||
@@ -124,7 +124,11 @@ func CreateArchive(client client.Interface, input cli.Input, includeFiles []stri
|
||||
return nil, err
|
||||
}
|
||||
|
||||
file := filepath.Join(tmpDir, uuid.NewV4().String())
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
file := filepath.Join(tmpDir, id.String())
|
||||
err = utils.DownloadUrl(context.Background(), http.DefaultClient, fileURL, file)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error downloading file from the given URL")
|
||||
|
||||
@@ -107,7 +107,11 @@ func DownloadToTempFile(fileUrl string) (string, error) {
|
||||
return "", errors.Wrapf(err, "error creating temp directory %v", tmpDir)
|
||||
}
|
||||
|
||||
tmpFilename := uuid.NewV4().String()
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "error generating UUID")
|
||||
}
|
||||
tmpFilename := id.String()
|
||||
destination := filepath.Join(tmpDir, tmpFilename)
|
||||
|
||||
err = WriteArchiveToFile(destination, reader)
|
||||
@@ -135,7 +139,11 @@ func WriteArchiveToFile(fileName string, reader io.Reader) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tmpFileName := uuid.NewV4().String()
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tmpFileName := id.String()
|
||||
|
||||
path := filepath.Join(tmpDir, tmpFileName+".tmp")
|
||||
w, err := os.Create(path)
|
||||
|
||||
Reference in New Issue
Block a user