Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReadHeaderTimeout for security #826

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions v2/protocol/http/abuse_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net/http"
"strconv"
"strings"
"time"
)

type WebhookConfig struct {
Expand All @@ -23,6 +24,7 @@ type WebhookConfig struct {

const (
DefaultAllowedRate = 1000
DefaultTimeout = time.Second * 600
)

// TODO: implement rate limiting.
Expand Down
6 changes: 4 additions & 2 deletions v2/protocol/http/protocol_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ func (p *Protocol) OpenInbound(ctx context.Context) error {
}

p.server = &http.Server{
Addr: listener.Addr().String(),
Handler: attachMiddleware(p.Handler, p.middleware),
Addr: listener.Addr().String(),
Handler: attachMiddleware(p.Handler, p.middleware),
ReadTimeout: DefaultTimeout,
WriteTimeout: DefaultTimeout,
}

// Shutdown
Expand Down