You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using exec.Command with user defined input, I expect G204 (Subprocess launched with variable) to trigger. However, if that user defined input is used directly from a function parameter, it does not trigger G204.
Summary
When using exec.Command with user defined input, I expect G204 (Subprocess launched with variable) to trigger. However, if that user defined input is used directly from a function parameter, it does not trigger G204.
Steps to reproduce the behavior
See this go program:
I'd expect this to trigger G204, however gosec reports no issues.
If I make a small change and assign the command string to a new variable, however, gosec properly detects the issue:
This DOES trigger G204, as expected.
gosec version
v2.20.0
Go version (output of 'go version')
go version go1.21.9 darwin/arm64
Operating system / Environment
macOS sonoma 14.5
Expected behavior
Expected G204 to trigger
Actual behavior
G204 does not trigger
The text was updated successfully, but these errors were encountered: