使用golangci的go exec命令安全性减少消息

我为gosec添加了一个golangci-lint棉绒,除以下内容外,所有内容都涵盖了:

exec.Command(params[0],params[1:]…)

我知道我可以禁用此皮棉,但是我不想这样做。有没有一种方法可以修复代码以满足该要求呢?

错误是:

 G204: Subprocess launched with function call as argument or cmd arguments ```
fanyinfu 回答:使用golangci的go exec命令安全性减少消息

对命令调用进行硬编码。有no other options个AFAIS。

,

您可以使用注释将特定行排除在外,而不是禁用linter;

concat('token=',**encodeUriComponent**(body('ApplicationToken')?['value']),'&user=',**encodeUriComponent**(body('UserToken')?['value']),'&title=Stock+Order+Status+Changed&message=to+do')
,

如果您想禁用此检查,您可以

exec.Command(params[0],params[1:]...) // #nosec G204

本文链接:https://www.f2er.com/3101219.html

大家都在问