Skip to content

Commit 57075c7

Browse files
committed
Add nolint comments for false positives for bridgecluster
1 parent 99458ba commit 57075c7

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

internal/bridge/client.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@ type ClusterRoleApiResource struct {
155155
ClusterId string `json:"cluster_id"`
156156
Flavor string `json:"flavor"`
157157
Name string `json:"name"`
158-
Password string `json:"password"`
159-
Team string `json:"team_id"`
160-
URI string `json:"uri"`
158+
//nolint:gosec // G117: JSON serialization field for API response, not a hardcoded credential.
159+
Password string `json:"password"`
160+
Team string `json:"team_id"`
161+
URI string `json:"uri"`
161162
}
162163

163164
// ClusterRoleList holds a slice of ClusterRoleApiResource
@@ -279,7 +280,7 @@ func (c *Client) doWithBackoff(
279280
if err == nil {
280281
request.Header = headers.Clone()
281282

282-
//nolint:bodyclose // This response is returned to the caller.
283+
//nolint:bodyclose,gosec // bodyclose: response returned to caller; G704: URL is from trusted Bridge API configuration.
283284
response, err = c.Do(request)
284285
}
285286

internal/bridge/crunchybridgecluster/mock_bridge_api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
)
1818

1919
type TestBridgeClient struct {
20+
//nolint:gosec // G117: Test mock struct field, not a hardcoded credential.
2021
ApiKey string `json:"apiKey,omitempty"`
2122
TeamId string `json:"teamId,omitempty"`
2223
Clusters []*bridge.ClusterApiResource `json:"clusters,omitempty"`

internal/bridge/crunchybridgecluster/postgres_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func TestGeneratePostgresRoleSecret(t *testing.T) {
3535
Name: "application",
3636
SecretName: "application-role-secret",
3737
}
38+
//nolint:gosec // G101: Test data with fake credentials for unit testing.
3839
role := &bridge.ClusterRoleApiResource{
3940
Name: "application",
4041
Password: "password",
@@ -148,6 +149,7 @@ func TestReconcilePostgresRoleSecrets(t *testing.T) {
148149
Name: "application",
149150
SecretName: "application-role-secret",
150151
}
152+
//nolint:gosec // G101: "postgres" is a role name, not a credential.
151153
postgresSpec := &v1beta1.CrunchyBridgeClusterRoleSpec{
152154
Name: "postgres",
153155
SecretName: "postgres-role-secret",

internal/bridge/installation.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ var self = new(struct {
3939
type AuthObject struct {
4040
ID string `json:"id"`
4141
ExpiresAt time.Time `json:"expires_at"`
42-
Secret string `json:"secret"`
42+
//nolint:gosec // G117: JSON serialization field for API response, not a hardcoded credential.
43+
Secret string `json:"secret"`
4344
}
4445

4546
type Installation struct {

pkg/apis/postgres-operator.crunchydata.com/v1beta1/crunchy_bridgecluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type CrunchyBridgeClusterSpec struct {
7777

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

8283
// The amount of storage available to the cluster in gigabytes.

0 commit comments

Comments
 (0)