fix(ws): set ReadHeaderTimeout to mitigate Slowloris attacks

Amolith created

Unsure whether 10s is sufficient, but it's a good starting point.

Change summary

cmd/willow.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

cmd/willow.go 🔗

@@ -12,6 +12,7 @@ import (
 	"os"
 	"strconv"
 	"sync"
+	"time"
 
 	"git.sr.ht/~amolith/willow/db"
 	"git.sr.ht/~amolith/willow/project"
@@ -120,8 +121,9 @@ func main() {
 	mux.HandleFunc("/", wsHandler.RootHandler)
 
 	httpServer := &http.Server{
-		Addr:    config.Server.Listen,
-		Handler: mux,
+		Addr:              config.Server.Listen,
+		Handler:           mux,
+		ReadHeaderTimeout: 10 * time.Second,
 	}
 
 	fmt.Println("Starting web server on", config.Server.Listen)