Skip to content
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: 1 addition & 1 deletion .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
cancel-in-progress: true
env:
GO_VERSION: 1.26.x
GOLANGCI_LINT_VERSION: v2.9
GOLANGCI_LINT_VERSION: v2.14.0
WASI_SDK_VERSION: 25
WASI_SDK_FULL_VERSION: "25.0"
jobs:
Expand Down
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ version: "2"
run:
allow-parallel-runners: true
modules-download-mode: readonly
issues:
max-issues-per-linter: 0
max-same-issues: 0
linters:
enable:
- durationcheck
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/auth/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func TestAuthShow(t *testing.T) {
Auth: config.Auth{
Default: "mytoken",
Tokens: config.AuthTokens{
"mytoken": &config.AuthToken{
"mytoken": &config.AuthToken{ // #nosec G101 (CWE-798)
Type: config.AuthTokenTypeStatic,
Token: "test-token-value",
Email: "alice@example.com",
Expand Down Expand Up @@ -495,7 +495,7 @@ func TestEnrichWithTokenSelfPreservesOnFailure(t *testing.T) {
},
})

at := &config.AuthToken{
at := &config.AuthToken{ // #nosec G101 (CWE-798)
Token: "existing-token",
APITokenName: "original-name",
APITokenScope: "global",
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/auth/revoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func TestAuthRevoke(t *testing.T) {
Default: "other",
Tokens: config.AuthTokens{
"other": &config.AuthToken{Type: config.AuthTokenTypeStatic, Token: "other-tok"},
"target": &config.AuthToken{Type: config.AuthTokenTypeStatic, Token: "tok-from-stdin"},
"target": &config.AuthToken{Type: config.AuthTokenTypeStatic, Token: "tok-from-stdin"}, // #nosec G101 (CWE-798)
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/auth/sso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ func TestSSO(t *testing.T) {
Result: result,
}
go func() {
result <- auth.AuthorizationResult{
result <- auth.AuthorizationResult{ // #nosec G101 (CWE-798)
SessionToken: "sso-env-token",
}
}()
Expand Down
10 changes: 5 additions & 5 deletions pkg/commands/compute/computeacl/computeacl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestComputeACLCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(acl)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(acl))),
},
},
},
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestComputeACLDescribe(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(acl)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(acl))),
},
},
},
Expand All @@ -195,7 +195,7 @@ func TestComputeACLDescribe(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(acl)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(acl))),
},
},
},
Expand Down Expand Up @@ -364,7 +364,7 @@ func TestComputeACLLookup(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(entry)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(entry))),
},
},
},
Expand All @@ -378,7 +378,7 @@ func TestComputeACLLookup(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(entry)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(entry))),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/dashboard/item/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
}

if success {
text.Success(out, `Removed %d dashboard item(s) from Custom Dashboard "%s" (dashboardID: %s)`, (numItems - (len(d.Items))), d.Name, d.ID)
text.Success(out, `Removed %d dashboard item(s) from Custom Dashboard "%s" (dashboardID: %s)`, (numItems - len(d.Items)), d.Name, d.ID)
} else {
text.Warning(out, "dashboard (%s) has no item with ID (%s)", d.ID, c.itemID)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/commands/ip/ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ func TestAllIPs(t *testing.T) {
API: &mock.API{
AllIPsFn: func(_ context.Context) (v4, v6 fastly.IPAddrs, err error) {
return []string{
"00.123.45.6/78",
}, []string{
"0a12:3b45::/67",
}, nil
"00.123.45.6/78",
}, []string{
"0a12:3b45::/67",
}, nil
},
},
WantOutput: "\nIPv4\n\t00.123.45.6/78\n\nIPv6\n\t0a12:3b45::/67\n",
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/ngwaf/customsignal/customsignal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestCustomSignalCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(customSignal)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(customSignal))),
},
},
},
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestCustomSignalGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(customSignal)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(customSignal))),
},
},
},
Expand All @@ -191,7 +191,7 @@ func TestCustomSignalGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(customSignal)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(customSignal))),
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/ngwaf/iplist/iplist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestIPListCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestIPListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand All @@ -213,7 +213,7 @@ func TestIPListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/commands/ngwaf/rule/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestRuleCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(rule)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(rule))),
},
},
},
Expand All @@ -103,7 +103,7 @@ func TestRuleCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(complexRule)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(complexRule))),
},
},
},
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestRuleGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(rule)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(rule))),
},
},
},
Expand All @@ -233,7 +233,7 @@ func TestRuleGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(rule)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(rule))),
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/ngwaf/signallist/signallist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestSignalListCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestSignalListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand All @@ -213,7 +213,7 @@ func TestSignalListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/ngwaf/stringlist/stringlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestStringListCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestStringListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand All @@ -213,7 +213,7 @@ func TestStringListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/ngwaf/wildcardlist/wildcardlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestWildcardListCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestWildcardListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand All @@ -213,7 +213,7 @@ func TestWildcardListGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
},
},
},
Expand Down
18 changes: 9 additions & 9 deletions pkg/commands/ngwaf/workspace/alert/datadog/datadog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestDatadogAlertCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusCreated,
Status: http.StatusText(http.StatusCreated),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(datadogAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(datadogAlert))),
},
},
},
Expand All @@ -78,7 +78,7 @@ func TestDatadogAlertCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusCreated,
Status: http.StatusText(http.StatusCreated),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(datadogAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(datadogAlert))),
},
},
},
Expand All @@ -92,7 +92,7 @@ func TestDatadogAlertCreate(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusCreated,
Status: http.StatusText(http.StatusCreated),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(datadogAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(datadogAlert))),
},
},
},
Expand Down Expand Up @@ -241,7 +241,7 @@ func TestDatadogAlertGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(datadogAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(datadogAlert))),
},
},
},
Expand All @@ -255,7 +255,7 @@ func TestDatadogAlertGet(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(datadogAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(datadogAlert))),
},
},
},
Expand Down Expand Up @@ -322,13 +322,13 @@ func TestDatadogAlertUpdate(t *testing.T) {
{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(datadogAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(datadogAlert))),
},
// Second response for PATCH (updating alert)
{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(updatedAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(updatedAlert))),
},
},
},
Expand All @@ -345,13 +345,13 @@ func TestDatadogAlertUpdate(t *testing.T) {
{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(datadogAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(datadogAlert))),
},
// Second response for PATCH (updating alert)
{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(updatedAlert)))),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(updatedAlert))),
},
},
},
Expand Down
Loading
Loading