Skip to content

Commit

Permalink
soroban-rpc: Limit request size to 10MB (stellar#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio authored Aug 24, 2023
1 parent 5b79166 commit 28478ef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/soroban-rpc/internal/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,20 @@ func NewJSONRPCHandler(cfg *config.Config, params HandlerParams) Handler {
Namespace: params.Daemon.MetricsNamespace(), Subsystem: "network", Name: "global_request_execution_duration_threshold_limit",
Help: "The metric measures the count of requests that surpassed the limit threshold for execution time",
})
durationLimitedBridge := network.MakeHTTPRequestDurationLimiter(
var handler http.Handler = network.MakeHTTPRequestDurationLimiter(
queueLimitedBridge,
cfg.RequestExecutionWarningThreshold,
cfg.MaxRequestExecutionDuration,
globalQueueRequestExecutionDurationWarningCounter,
globalQueueRequestExecutionDurationLimitCounter,
params.Logger)

// Limit request sizes to 10MB
handler = http.MaxBytesHandler(handler, 1024*1024*10)

return Handler{
bridge: bridge,
logger: params.Logger,
Handler: durationLimitedBridge,
Handler: handler,
}
}

0 comments on commit 28478ef

Please sign in to comment.