Ensure http.Server has idle and read timeouts configured#30151
Ensure http.Server has idle and read timeouts configured#30151
Conversation
Configures the `ReadHeaderTimeout` and `IdleTimeout` for instances of `http.Server` highlighted by `gosec`.
| "google.golang.org/grpc/credentials/insecure" | ||
| "google.golang.org/protobuf/proto" | ||
|
|
||
| apidefaults "github.com/gravitational/teleport/api/defaults" |
There was a problem hiding this comment.
nit: there's only a single defaults package imported here so we can drop the alias
| apidefaults "github.com/gravitational/teleport/api/defaults" | |
| "github.com/gravitational/teleport/api/defaults" |
There was a problem hiding this comment.
Current imports of this defaults all seemed to be consistently aliasing to apidefaults. So I was just trying to stay consistent to that existing usage. Let me know your thoughts
There was a problem hiding this comment.
That's likely only the case when "github.com/gravitational/teleport/lib/defaults" is also imported
There was a problem hiding this comment.
IMO having the same aliases across all files makes things simpler. Otherwise, if lib/defaults is added to these files, we may end up with libdefaults and defaults, which points to something completely different than you would expect.
Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
This commit builds on the work from #30151 in the following ways: * A couple additional server configuartions that were missing timeouts are now covered * Timeouts are now configured in a consistent way. This means: - Configuring the `ReadTimeout` which was not covered by only setting `ReadHeaderTimeout` - Set `ReadHeaderTimeout` to be the more aggressive (1 second) `defaults.ReadHeadersTimeout` - Set a `WriteTimeout` in cases of potential large responses
This commit builds on the work from #30151 in the following ways: * A couple additional server configuartions that were missing timeouts are now covered * Timeouts are now configured in a consistent way. This means: - Configuring the `ReadTimeout` which was not covered by only setting `ReadHeaderTimeout` - Set `ReadHeaderTimeout` to be the more aggressive (1 second) `defaults.ReadHeadersTimeout` - Set a `WriteTimeout` in cases of potential large responses
* Consistent `http.Server` timeout configurations This commit builds on the work from #30151 in the following ways: * A couple additional server configuartions that were missing timeouts are now covered * Timeouts are now configured in a consistent way. This means: - Configuring the `ReadTimeout` which was not covered by only setting `ReadHeaderTimeout` - Set `ReadHeaderTimeout` to be the more aggressive (1 second) `defaults.ReadHeadersTimeout` - Set a `WriteTimeout` in cases of potential large responses * defaults.go: Update ReadHeadersTimeout to 10 seconds * alpnproxy/local_proxy.go: Move http timeouts to the top
Configures the
ReadHeaderTimeoutandIdleTimeoutfor instances ofhttp.Serverhighlighted bygosec. Similar to the PR here: https://github.com/gravitational/teleport.e/pull/1948