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

View File

@@ -10,7 +10,7 @@
<h1>VPPN</h1> <h1>VPPN</h1>
<nav> <nav>
{{if .Session.SessionID -}} {{if .Session.SessionID -}}
<a href="/admin/networks/list/">Home</a> / <a href="/admin/network/list/">Home</a> /
<a href="/admin/sign-out/">Sign out</a> <a href="/admin/sign-out/">Sign out</a>
{{- end}} {{- end}}
</nav> </nav>

View File

@@ -42,8 +42,8 @@
<td>{{.Port}}</td> <td>{{.Port}}</td>
<td>{{if .Relay}}T{{else}}F{{end}}</td> <td>{{if .Relay}}T{{else}}F{{end}}</td>
</tr> </tr>
</tbody>
{{- end}} {{- end}}
</tbody>
</table> </table>
{{- else}} {{- else}}
<p>No peers.</p> <p>No peers.</p>