Audit cleanup

This commit is contained in:
jdl
2026-06-16 18:08:01 +02:00
parent a2fe8dc79d
commit b290b13ae1
3 changed files with 6 additions and 8 deletions

View File

@@ -248,6 +248,7 @@ func (a *App) _adminPasswordSubmit(s *api.Session, w http.ResponseWriter, r *htt
return err
}
// 72 is max password length for bcrypt.
if len(newPwd) < 8 || len(newPwd) > 72 {
return errs.ErrInvalidPassword
}
@@ -281,8 +282,7 @@ func (a *App) _adminPasswordSubmit(s *api.Session, w http.ResponseWriter, r *htt
func (a *App) _peerInit(peer *api.Peer, w http.ResponseWriter, r *http.Request) error {
if len(peer.WGPubKey) != 0 {
http.Error(w, "Already initialized", http.StatusConflict)
return nil
return errs.BadRequest.WithMsg("Already initialized")
}
r.Body = http.MaxBytesReader(w, r.Body, 2048)
@@ -293,12 +293,10 @@ func (a *App) _peerInit(peer *api.Peer, w http.ResponseWriter, r *http.Request)
}
if len(args.WGPubKey) != 32 {
http.Error(w, "invalid WGPubKey", http.StatusBadRequest)
return nil
return errs.BadRequest.WithMsg("Invalid WGPubKey.")
}
if len(args.SignPubKey) != 32 {
http.Error(w, "invalid SignPubKey", http.StatusBadRequest)
return nil
return errs.BadRequest.WithMsg("Invalid SignPubKey.")
}
net, err := a.api.Network_Get(peer.NetworkID)