Skip to content

Fix '/tmp/gosec.json: no such file or directory' bug

Julian Thome requested to merge passhtroughbug into master

What does this MR do?

This MR fixes an issue with gosec; a missing check whether passthroughs are defined causes the problem that the ProcessPassthroughs functions is called anyway and returns a configuration location that is empty which leads to an error when this configuration is passed through to gosec.

/app # /analyzer run
[INFO] [Gosec] [2021-12-15T08:05:49Z] ▶ GitLab Gosec analyzer v3.4.1
[INFO] [Gosec] [2021-12-15T08:05:49Z] ▶ Detecting project
[INFO] [Gosec] [2021-12-15T08:05:49Z] ▶ Found relevant files in project, analyzing entire repository
[INFO] [Gosec] [2021-12-15T08:05:49Z] ▶ Running analyzer
[INFO] [Gosec] [2021-12-15T08:05:49Z] ▶ using /go/src/app for the go pkg path
[INFO] [Gosec] [2021-12-15T08:05:49Z] ▶ go modules detected
[INFO] [Gosec] [2021-12-15T08:05:49Z] ▶ Fetching dependencies...
[DEBU] [Gosec] [2021-12-15T08:05:51Z] ▶ /usr/local/go/bin/go get -d ./...
go: downloading github.com/lib/pq v1.10.4
go: downloading golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b
go: downloading golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1

[INFO] [Gosec] [2021-12-15T08:05:51Z] ▶ Running passtroughs with timeout 60
[INFO] [Gosec] [2021-12-15T08:05:51Z] ▶ Running gosec...
[DEBU] [Gosec] [2021-12-15T08:05:51Z] ▶ /bin/gosec -conf /app -fmt=json -out=/tmp/gosec.json ./...
[gosec] 2021/12/15 08:05:51 read /app: is a directory

[FATA] [Gosec] [2021-12-15T08:05:51Z] ▶ open /tmp/gosec.json: no such file or directory

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Lucas Charles

Merge request reports