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:
Sanket Sudake
2021-10-06 13:24:54 +05:30
committed by GitHub
parent 0d319c07ae
commit e4d5565f8e
19 changed files with 113 additions and 36 deletions
+5 -1
View File
@@ -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{
+5 -1
View File
@@ -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")
+10 -2
View File
@@ -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)