From f11a041f565ba225bb473902d408edbd9a9d32df Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 5 May 2021 17:41:25 +0200 Subject: [PATCH] cleanup: address gosec complaint about creating a file The new gosec 2.7.0 complains like: G304 (CWE-22): Potential file inclusion via variable (Confidence: HIGH, Severity: MEDIUM) Updates: #2025 Signed-off-by: Niels de Vos --- internal/rbd/nodeserver.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index e4fb269c9..7fa58003a 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -362,6 +362,7 @@ func (ns *NodeServer) undoStagingTransaction(ctx context.Context, req *csi.NodeS func (ns *NodeServer) createStageMountPoint(ctx context.Context, mountPath string, isBlock bool) error { if isBlock { + // #nosec:G304, intentionally creating file mountPath, not a security issue pathFile, err := os.OpenFile(mountPath, os.O_CREATE|os.O_RDWR, 0600) if err != nil { util.ErrorLog(ctx, "failed to create mountPath:%s with error: %v", mountPath, err)