Skip to content

Commit

Permalink
chore: Add //nolint:gosec
Browse files Browse the repository at this point in the history
ParseInt(x,x,32) makes sure it will fit into int32.

See also securego/gosec#1185

Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
  • Loading branch information
viccuad committed Aug 28, 2024
1 parent c76a223 commit 4508e2d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/controller/policyserver_controller_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func getMetricsPort() int32 {
fmt.Fprintf(os.Stderr, "port %s provided in %s envvar cannot be parsed as integer: %v. Aborting.\n", envMetricsPort, constants.PolicyServerMetricsPortEnvVar, err)
os.Exit(1)
}
//nolint:gosec ParseInt(x,x,32) makes sure it will fit into int32

Check failure on line 31 in internal/controller/policyserver_controller_service.go

View workflow job for this annotation

GitHub Actions / Golangci-lint

directive `//nolint:gosec ParseInt(x,x,32) makes sure it will fit into int32` should match `//nolint[:<comma-separated-linters>] [// <explanation>]` (nolintlint)

Check failure on line 31 in internal/controller/policyserver_controller_service.go

View workflow job for this annotation

GitHub Actions / Golangci-lint

directive `//nolint:gosec ParseInt(x,x,32) makes sure it will fit into int32` should match `//nolint[:<comma-separated-linters>] [// <explanation>]` (nolintlint)
metricsPort = int32(metricsPortInt32)

Check failure on line 32 in internal/controller/policyserver_controller_service.go

View workflow job for this annotation

GitHub Actions / Golangci-lint

G115: integer overflow conversion int64 -> int32 (gosec)

Check failure on line 32 in internal/controller/policyserver_controller_service.go

View workflow job for this annotation

GitHub Actions / Golangci-lint

G115: integer overflow conversion int64 -> int32 (gosec)
}
return metricsPort
Expand Down

0 comments on commit 4508e2d

Please sign in to comment.