Skip to content

Commit

Permalink
enable gosec linter again
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
  • Loading branch information
berndverst committed Aug 18, 2022
1 parent 1b451d0 commit 942b0d1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ linters:
- godot
- cyclop
- varnamelen
- gosec
- errorlint
- forcetypeassert
- ifshort
Expand Down
1 change: 1 addition & 0 deletions internal/eventbus/event_bus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The MIT License (MIT)
Copyright (c) 2014 Alex Saskevich
*/

//nolint:errcheck
package eventbus

import (
Expand Down
3 changes: 1 addition & 2 deletions secretstores/azure/keyvault/keyvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ func (k *keyvaultSecretStore) getVaultURI() string {

func (k *keyvaultSecretStore) getMaxResultsFromMetadata(metadata map[string]string) (*int32, error) {
if s, ok := metadata["maxresults"]; ok && s != "" {
/* #nosec */
val, err := strconv.Atoi(s)
val, err := strconv.Atoi(s) //nolint:gosec
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion state/mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const (
connectionURIFormatWithSrv = "mongodb+srv://%s/%s"

// mongodb+srv://<username>:<password>@<server>/<params>
connectionURIFormatWithSrvAndCredentials = "mongodb+srv://%s:%s@%s/%s%s"
connectionURIFormatWithSrvAndCredentials = "mongodb+srv://%s:%s@%s/%s%s" //nolint:gosec
)

// MongoDB is a state store implementation for MongoDB.
Expand Down
5 changes: 5 additions & 0 deletions state/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ func (m *MySQL) ensureStateTable(stateTableName string) error {
// never need to pass it in.
// eTag is a UUID stored as a 36 characters string. It needs to be passed
// in on inserts and updates and is used for Optimistic Concurrency

// adding a basic precaution to ensure our SQL query is not hijacked
stateTableName = strings.Split(strings.Split(stateTableName, ";")[0], " ")[0]

//nolint:gosec
createTable := fmt.Sprintf(`CREATE TABLE %s (
id VARCHAR(255) NOT NULL PRIMARY KEY,
value JSON NOT NULL,
Expand Down
6 changes: 4 additions & 2 deletions tests/conformance/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ func ConformanceTests(t *testing.T, props map[string]string, statestore state.St
}
}

transactionStore := statestore.(state.TransactionalStore)
transactionStore, ok := statestore.(state.TransactionalStore)
assert.True(t, ok)
sort.Ints(transactionGroups)
for _, transactionGroup := range transactionGroups {
t.Logf("Testing transaction #%d", transactionGroup)
Expand Down Expand Up @@ -547,7 +548,8 @@ func ConformanceTests(t *testing.T, props map[string]string, statestore state.St
}

// Act
transactionStore := statestore.(state.TransactionalStore)
transactionStore, ok := statestore.(state.TransactionalStore)
assert.True(t, ok)
err = transactionStore.Multi(&state.TransactionalStateRequest{
Operations: operations,
Metadata: partitionMetadata,
Expand Down

0 comments on commit 942b0d1

Please sign in to comment.