Skip to content

Commit 27f665e

Browse files
committed
Silent false positive G702
It is by design that the admin passes the configuration via environment variable.
1 parent 317b9ee commit 27f665e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/controller/secret_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (r *SecretReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
112112
// Save the last resource version to file system
113113
pki := os.Getenv("PKI_PATH")
114114
path := filepath.Join(pki, "CA", ".last_resource_version")
115-
if err = os.WriteFile(path, []byte(secret.ResourceVersion), 0600); err != nil {
115+
if err = os.WriteFile(path, []byte(secret.ResourceVersion), 0600); err != nil { //nolint:gosec // PKI_PATH is controlled by deployment configuration
116116
// not a failure condition, just log the error
117117
log.Error(err, "failed to write last resource version", "path", path)
118118
}
@@ -128,7 +128,7 @@ func (r *SecretReconciler) SetupWithManager(mgr ctrl.Manager) error {
128128
// processing if the resource version hasn't changed
129129
pki := os.Getenv("PKI_PATH")
130130
path := filepath.Join(pki, "CA", ".last_resource_version")
131-
if buf, err := os.ReadFile(path); err != nil {
131+
if buf, err := os.ReadFile(path); err != nil { //nolint:gosec // PKI_PATH is controlled by deployment configuration
132132
logger.Log.Info("No last resource version found for PKI secrets", "path", path)
133133
} else {
134134
r.lastResourceVersion = string(buf)

0 commit comments

Comments
 (0)