Skip to content

Commit b9a3225

Browse files
authored
[filesystem] add missing tags on configuration structure (#102)
* [filesystem] add missing tags on configuration structure * comment out gci * linting
1 parent 90c501b commit b9a3225

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

.golangci.pre-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ linters:
99
disable-all: true # Disable defaults, then enable the ones we want
1010
enable:
1111
- goimports
12-
- gci
12+
# - gci FIXME uncomment when https://github.com/golangci/golangci-lint/issues/2985 is fixed
1313

1414
# Auto-fix any found issues
1515
issues:

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ linters:
2222
- stylecheck
2323
- gosec
2424
- goimports
25-
- gci
25+
# - gci FIXME uncomment when https://github.com/golangci/golangci-lint/issues/2985 is fixed
2626

2727
linters-settings:
2828
goimports:

changes/202207181519.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`[filesystem]` Updated limit structure to have tags specified

changes/202207181802.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`[httptest]` Fixed security issue `(G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec))`

utils/filesystem/limits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ func (n *noLimits) Validate() error {
2727

2828
// Limits defines file system limits
2929
type Limits struct {
30-
MaxFileSize int64
31-
MaxTotalSize uint64
30+
MaxFileSize int64 `mapstructure:"max_file_size"`
31+
MaxTotalSize uint64 `mapstructure:"max_total_size"`
3232
}
3333

3434
func (l *Limits) Apply() bool {

utils/http/httptest/testing.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"net"
1111
"net/http"
1212
"testing"
13+
"time"
1314

1415
"github.com/stretchr/testify/require"
1516

@@ -20,7 +21,11 @@ import (
2021
func NewTestServer(t *testing.T, ctx context.Context, handler http.Handler, port string) {
2122
list, err := net.Listen("tcp", fmt.Sprintf(":%v", port))
2223
require.Nil(t, err)
23-
srv := &http.Server{Handler: handler}
24+
srv := &http.Server{
25+
Handler: handler,
26+
ReadHeaderTimeout: time.Minute,
27+
ReadTimeout: time.Minute,
28+
}
2429
err = parallelisation.DetermineContextError(ctx)
2530
if err != nil {
2631
return

0 commit comments

Comments
 (0)