iot-onboarding / iot-onboarding/mudcerts

Security: set explicit HTTP server timeouts (CWE-400 / slowloris)

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1
Forks
1
Avg merge
13h 20m
Merged PRs (30d)
3

Description

**Severity:** Medium
**Files:** `web/mudzipserver.go`

`router.Run(":8085")` uses default `http.Server` with zero `ReadTimeout`, `WriteTimeout`, `IdleTimeout`, and `ReadHeaderTimeout`. Slow-body / slow-header attackers can tie up goroutines indefinitely.

### Remediation
Construct an explicit server:

```go
srv := &http.Server{
Addr: ":8085",
Handler: router,
ReadHeaderTimeout: 5 * time.Second,
ReadTimeout: 15 * time.Second,
WriteTimeout: 30 * time.Second,
IdleTimeout: 60 * time.Second,
}
log.Fatal(srv.ListenAndServe())
```

**Refs:** CWE-400.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.