Skip to content
Open
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
10 changes: 4 additions & 6 deletions internal/bridge/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ type ClusterRoleApiResource struct {
ClusterId string `json:"cluster_id"`
Flavor string `json:"flavor"`
Name string `json:"name"`
//nolint:gosec // G117: JSON serialization field for API response, not a hardcoded credential.
Password string `json:"password"`
Team string `json:"team_id"`
URI string `json:"uri"`
Password string `json:"password"`
Team string `json:"team_id"`
URI string `json:"uri"`
}

// ClusterRoleList holds a slice of ClusterRoleApiResource
Expand Down Expand Up @@ -279,8 +278,7 @@ func (c *Client) doWithBackoff(

if err == nil {
request.Header = headers.Clone()

//nolint:bodyclose,gosec // bodyclose: response returned to caller; G704: URL is from trusted Bridge API configuration.
//nolint:bodyclose // response returned to caller.
response, err = c.Do(request)
}

Expand Down
3 changes: 3 additions & 0 deletions internal/bridge/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,7 @@ func TestGetClusterRole(t *testing.T) {
}

t.Run("WeSendCorrectData", func(t *testing.T) {
//nolint:gosec // G117: Password is part of the API resource struct, not a credential in test context.
responsePayloadJson, err := json.Marshal(clusterRoleApiResource)
assert.NilError(t, err)

Expand All @@ -1251,6 +1252,7 @@ func TestGetClusterRole(t *testing.T) {
})

t.Run("OkResponse", func(t *testing.T) {
//nolint:gosec // G117: Password is part of the API resource struct, not a credential in test context.
responsePayloadJson, err := json.Marshal(clusterRoleApiResource)
assert.NilError(t, err)

Expand All @@ -1269,6 +1271,7 @@ func TestGetClusterRole(t *testing.T) {
})

t.Run("ErrorResponse", func(t *testing.T) {
//nolint:gosec // G117: Password is part of the API resource struct, not a credential in test context.
responsePayloadJson, err := json.Marshal(clusterRoleApiResource)
assert.NilError(t, err)

Expand Down
1 change: 0 additions & 1 deletion internal/bridge/crunchybridgecluster/mock_bridge_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

type TestBridgeClient struct {
//nolint:gosec // G117: Test mock struct field, not a hardcoded credential.
ApiKey string `json:"apiKey,omitempty"`
TeamId string `json:"teamId,omitempty"`
Clusters []*bridge.ClusterApiResource `json:"clusters,omitempty"`
Expand Down
3 changes: 1 addition & 2 deletions internal/bridge/installation.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ var self = new(struct {
type AuthObject struct {
ID string `json:"id"`
ExpiresAt time.Time `json:"expires_at"`
//nolint:gosec // G117: JSON serialization field for API response, not a hardcoded credential.
Secret string `json:"secret"`
Secret string `json:"secret"`
}

type Installation struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/postgres_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func EnablePostgresMetrics(ctx context.Context, inCluster *v1beta1.PostgresClust
// appendToJSONArray appends elements of a json.RawMessage containing an array
// to another json.RawMessage containing an array.
func appendToJSONArray(a1, a2 json.RawMessage) (json.RawMessage, error) {
var slc1 []json.RawMessage
var slc1 []json.RawMessage //nolint:prealloc // Populated by json.Unmarshal, not manual appends.
if err := json.Unmarshal(a1, &slc1); err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/standalone_pgadmin/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type pgAdminUserForJson struct {
IsAdmin bool `json:"isAdmin"`

// The user's password
//nolint:gosec // G117: This is a JSON serialization struct, not a hardcoded credential.
Password string `json:"password"`

// The username for User in pgAdmin.
Expand Down Expand Up @@ -332,6 +331,8 @@ cd $PGADMIN_DIR
// to add a user, that user will not be in intentUsers. If errors occurred when attempting to
// update a user, the user will be in intentUsers as it existed before. We now want to marshal the
// intentUsers to json and write the users.json file to the secret.

//nolint:gosec // G117: Password is intentionally stored in a Kubernetes Secret.
intentUserSecret.Data["users.json"], _ = json.Marshal(intentUsers)

err = errors.WithStack(r.setControllerReference(pgadmin, intentUserSecret))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ type CrunchyBridgeClusterSpec struct {

// The name of the secret containing the API key and team id
// +kubebuilder:validation:Required
//nolint:gosec // G117: Field holds secret name reference, not actual secret data.
Secret string `json:"secret"`

// The amount of storage available to the cluster in gigabytes.
Expand Down
Loading