Compare commits
2 Commits
2113e8eade
...
12869d1ec0
Author | SHA1 | Date | |
---|---|---|---|
12869d1ec0 | |||
0341c7c6b3 |
@ -41,6 +41,7 @@ var (
|
||||
ErrInvalidHdrVal = errors.New("invalid header value type")
|
||||
ErrInvalidType = errors.New("invalid type")
|
||||
ErrInsecureWebhook = errors.New("secure webhook missing authorization")
|
||||
ErrIncorrectPassword = errors.New("incorrect password")
|
||||
)
|
||||
|
||||
var httpModule = &starlarkstruct.Module{
|
||||
@ -355,7 +356,7 @@ func verifySecure(pwdHash, pluginName string, req *http.Request) error {
|
||||
fmt.Println(string(pwd))
|
||||
|
||||
if err := bcrypt.CompareHashAndPassword([]byte(pwdHash), pwd); err != nil {
|
||||
return err
|
||||
return ErrIncorrectPassword
|
||||
}
|
||||
|
||||
return nil
|
||||
|
6
main.go
6
main.go
@ -41,7 +41,6 @@ import (
|
||||
|
||||
func init() {
|
||||
log.Logger = logger.NewPretty(os.Stderr)
|
||||
log.Logger.SetLevel(logger.LogLevelDebug)
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -51,8 +50,13 @@ func main() {
|
||||
serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address")
|
||||
genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks")
|
||||
useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration")
|
||||
debug := pflag.BoolP("debug", "d", false, "Enable debug logging")
|
||||
pflag.Parse()
|
||||
|
||||
if *debug {
|
||||
log.Logger.SetLevel(logger.LogLevelDebug)
|
||||
}
|
||||
|
||||
if *genHash {
|
||||
fmt.Print("Password: ")
|
||||
pwd, err := term.ReadPassword(int(os.Stdin.Fd()))
|
||||
|
Loading…
Reference in New Issue
Block a user