mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
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 <ndevos@redhat.com>
This commit is contained in:
parent
07a916b84d
commit
f11a041f56
@ -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 {
|
func (ns *NodeServer) createStageMountPoint(ctx context.Context, mountPath string, isBlock bool) error {
|
||||||
if isBlock {
|
if isBlock {
|
||||||
|
// #nosec:G304, intentionally creating file mountPath, not a security issue
|
||||||
pathFile, err := os.OpenFile(mountPath, os.O_CREATE|os.O_RDWR, 0600)
|
pathFile, err := os.OpenFile(mountPath, os.O_CREATE|os.O_RDWR, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.ErrorLog(ctx, "failed to create mountPath:%s with error: %v", mountPath, err)
|
util.ErrorLog(ctx, "failed to create mountPath:%s with error: %v", mountPath, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user