Skip to content

Commit 9865420

Browse files
committed
linting: G112: Potential Slowloris Attack
Picking 2 seconds, although that's just a randomly picked timeout; given that this is only for testing, it's not too important. e2e/plugin/basic/basic.go:25:12: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) server := http.Server{ Addr: l.Addr().String(), Handler: http.NewServeMux(), } Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent b58731f commit 9865420

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

e2e/plugin/basic/basic.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/http"
77
"os"
88
"path/filepath"
9+
"time"
910
)
1011

1112
func main() {
@@ -23,8 +24,9 @@ func main() {
2324

2425
mux := http.NewServeMux()
2526
server := http.Server{
26-
Addr: l.Addr().String(),
27-
Handler: http.NewServeMux(),
27+
Addr: l.Addr().String(),
28+
Handler: http.NewServeMux(),
29+
ReadHeaderTimeout: 2 * time.Second, // G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server
2830
}
2931
mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) {
3032
w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1.1+json")

0 commit comments

Comments
 (0)