mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-20 21:36:30 +02:00
Restrict rehash hashes to secure hashes
This commit is contained in:
parent
4779b0a218
commit
2d181f9f70
@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/packwiz/packwiz/core"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
// rehashCmd represents the rehash command
|
||||
@ -36,6 +37,11 @@ var rehashCmd = &cobra.Command{
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if !slices.Contains([]string{"sha1", "sha512", "sha256"}, args[0]) {
|
||||
fmt.Printf("Hash format '%s' is not supported\n", args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
session, err := core.CreateDownloadSession(mods, []string{args[0]})
|
||||
if err != nil {
|
||||
fmt.Printf("Error retrieving external files: %v\n", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user