Skip to content

Commit

Permalink
fix(lint/gosec): use of net/http serve function that has no support f…
Browse files Browse the repository at this point in the history
…or setting timeouts
  • Loading branch information
lburgazzoli committed Aug 23, 2024
1 parent 228b050 commit 3f8c851
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,17 @@ var serverCmd = &cobra.Command{

addr := fmt.Sprintf(":%d", port)
log.Info().Int("port", port).Msg("Starting HTTP server")
log.Fatal().Err(http.ListenAndServe(addr, router))

// TODO: must validate values
s := &http.Server{
Addr: addr,
ReadHeaderTimeout: 20 * time.Second,
ReadTimeout: 1 * time.Minute,
WriteTimeout: 2 * time.Minute,
Handler: router,
}

log.Fatal().Err(s.ListenAndServe())
},
}

Expand Down

0 comments on commit 3f8c851

Please sign in to comment.