Skip to content

Commit 7a96dbc

Browse files
anoopcs9mergify[bot]
authored andcommitted
hack: Bump gosec to v2.22.9
With go1.24 as a oldstable release, it is recommended to use a gosec version supporting go1.24 (from v2.22.1[1]) to avoid any unexpected errors. Additionally fix/ignore the newly reported gosec errors. [1] https://github.com/securego/gosec/releases/tag/v2.22.1 Signed-off-by: Anoop C S <[email protected]>
1 parent f41c1f3 commit 7a96dbc

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

hack/install-tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ _install_yq() {
5252
}
5353

5454
_install_gosec() {
55-
_install_tool github.com/securego/gosec/v2/cmd/gosec@v2.20.0
55+
_install_tool github.com/securego/gosec/v2/cmd/gosec@v2.22.9
5656
}
5757

5858
_install_gitlint() {

internal/planner/properties.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (pl *Planner) ClusterSize() int32 {
9999
if pl.SmbShare.Spec.Scaling == nil {
100100
return 1
101101
}
102-
return int32(pl.SmbShare.Spec.Scaling.MinClusterSize)
102+
return int32(pl.SmbShare.Spec.Scaling.MinClusterSize) // #nosec G115
103103
}
104104

105105
// Grouping returns the logical grouping mode and group name.

internal/resources/metrics.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func buildSmbMetricsContainer(image string,
5353
Name: "samba-metrics",
5454
Command: []string{"/bin/smbmetrics"},
5555
Ports: []corev1.ContainerPort{{
56-
ContainerPort: int32(portnum),
56+
ContainerPort: int32(portnum), // #nosec G115 – safe constant 8080
5757
Name: "smbmetrics",
5858
}},
5959
VolumeMounts: volmnts,
@@ -111,11 +111,11 @@ func (m *SmbShareManager) getOrCreateMetricsService(
111111
Ports: []corev1.ServicePort{
112112
{
113113
Name: defaultMetricsPortName,
114-
Port: int32(defaultMetricsPort),
114+
Port: int32(defaultMetricsPort), // #nosec G115 – safe constant 8080
115115
Protocol: corev1.ProtocolTCP,
116116
TargetPort: intstr.IntOrString{
117117
Type: intstr.Int,
118-
IntVal: int32(defaultMetricsPort),
118+
IntVal: int32(defaultMetricsPort), // #nosec G115 – safe constant 8080
119119
},
120120
},
121121
},

internal/resources/pods.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ func buildSmbdCtr(
464464
Args: planner.Args().Run("smbd"),
465465
Env: env,
466466
Ports: []corev1.ContainerPort{{
467-
ContainerPort: int32(portnum),
467+
ContainerPort: int32(portnum), // #nosec G115 – safe constant 445
468468
Name: "smb",
469469
}},
470470
VolumeMounts: mounts,

internal/resources/services.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ func newServiceForSmb(planner *pln.Planner, ns string) *corev1.Service {
3636
Spec: corev1.ServiceSpec{
3737
Type: toServiceType(planner.ServiceType()),
3838
Ports: []corev1.ServicePort{{
39-
Name: "smb",
40-
Protocol: corev1.ProtocolTCP,
41-
Port: int32(planner.GlobalConfig.SmbServicePort),
39+
Name: "smb",
40+
Protocol: corev1.ProtocolTCP,
41+
// revive:disable:line-length-limit gosec rule ignore
42+
Port: int32(planner.GlobalConfig.SmbServicePort), // #nosec G115 – safe constant 445
43+
// revive:enable:line-length-limit
4244
TargetPort: intstr.FromInt(planner.GlobalConfig.SmbdPort),
4345
}},
4446
Selector: map[string]string{

internal/resources/smbshare.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,9 @@ func (m *SmbShareManager) updateClusteredState(
373373

374374
resized, err := m.updateStatefulSetSize(
375375
ctx, statefulSet,
376-
int32(planner.SmbShare.Spec.Scaling.MinClusterSize))
376+
// revive:disable:line-length-limit gosec rule ignore
377+
int32(planner.SmbShare.Spec.Scaling.MinClusterSize)) // #nosec G115
378+
// revive:enable:line-length-limit
377379
if err != nil {
378380
return Result{err: err}
379381
}

0 commit comments

Comments
 (0)