diff --git a/.golangci.pre-commit.yaml b/.golangci.pre-commit.yaml index 031d43be60..3d2aec1fa4 100644 --- a/.golangci.pre-commit.yaml +++ b/.golangci.pre-commit.yaml @@ -9,7 +9,7 @@ linters: disable-all: true # Disable defaults, then enable the ones we want enable: - goimports - - gci + # - gci FIXME uncomment when https://github.com/golangci/golangci-lint/issues/2985 is fixed # Auto-fix any found issues issues: diff --git a/.golangci.yaml b/.golangci.yaml index 51e8597d66..a3460c29f5 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -22,7 +22,7 @@ linters: - stylecheck - gosec - goimports - - gci + # - gci FIXME uncomment when https://github.com/golangci/golangci-lint/issues/2985 is fixed linters-settings: goimports: diff --git a/changes/202207181519.bugfix b/changes/202207181519.bugfix new file mode 100644 index 0000000000..d1e10b7a75 --- /dev/null +++ b/changes/202207181519.bugfix @@ -0,0 +1 @@ +`[filesystem]` Updated limit structure to have tags specified diff --git a/changes/202207181802.bugfix b/changes/202207181802.bugfix new file mode 100644 index 0000000000..6feebd531e --- /dev/null +++ b/changes/202207181802.bugfix @@ -0,0 +1 @@ +`[httptest]` Fixed security issue `(G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec))` diff --git a/utils/filesystem/limits.go b/utils/filesystem/limits.go index 58761acbd7..325341dcef 100644 --- a/utils/filesystem/limits.go +++ b/utils/filesystem/limits.go @@ -27,8 +27,8 @@ func (n *noLimits) Validate() error { // Limits defines file system limits type Limits struct { - MaxFileSize int64 - MaxTotalSize uint64 + MaxFileSize int64 `mapstructure:"max_file_size"` + MaxTotalSize uint64 `mapstructure:"max_total_size"` } func (l *Limits) Apply() bool { diff --git a/utils/http/httptest/testing.go b/utils/http/httptest/testing.go index 465502044b..294fefd199 100644 --- a/utils/http/httptest/testing.go +++ b/utils/http/httptest/testing.go @@ -10,6 +10,7 @@ import ( "net" "net/http" "testing" + "time" "github.com/stretchr/testify/require" @@ -20,7 +21,11 @@ import ( func NewTestServer(t *testing.T, ctx context.Context, handler http.Handler, port string) { list, err := net.Listen("tcp", fmt.Sprintf(":%v", port)) require.Nil(t, err) - srv := &http.Server{Handler: handler} + srv := &http.Server{ + Handler: handler, + ReadHeaderTimeout: time.Minute, + ReadTimeout: time.Minute, + } err = parallelisation.DetermineContextError(ctx) if err != nil { return