mirror of
				https://github.com/packwiz/packwiz.git
				synced 2025-11-03 19:54:32 +01:00 
			
		
		
		
	Restrict rehash hashes to secure hashes
This commit is contained in:
		@@ -6,6 +6,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	"github.com/packwiz/packwiz/core"
 | 
						"github.com/packwiz/packwiz/core"
 | 
				
			||||||
	"github.com/spf13/cobra"
 | 
						"github.com/spf13/cobra"
 | 
				
			||||||
 | 
						"golang.org/x/exp/slices"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// rehashCmd represents the rehash command
 | 
					// rehashCmd represents the rehash command
 | 
				
			||||||
@@ -36,6 +37,11 @@ var rehashCmd = &cobra.Command{
 | 
				
			|||||||
			os.Exit(1)
 | 
								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]})
 | 
							session, err := core.CreateDownloadSession(mods, []string{args[0]})
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			fmt.Printf("Error retrieving external files: %v\n", err)
 | 
								fmt.Printf("Error retrieving external files: %v\n", err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user