From 1d6ec9b5c4cf1741c3a019fd8a99b027be64864a Mon Sep 17 00:00:00 2001 From: closer-claudio Date: Sun, 15 Nov 2026 17:58:49 -0800 Subject: [PATCH] lint: gosec leaves the backlog, its one finding judged and left as it is gosec was exempted in git/commits.go at enrolment, for eight launches of git with arguments that are not constants. The package has since come to launch git in one place, command, and that is the one finding left: G204, a subprocess launched with a variable. It is right as it is. The program is the constant git. Its arguments are the subcommands this file writes, the commits git itself named, and the range the operator gave: by --range, or by the variables of their CI that the command reads (TRAVIS_COMMIT_RANGE, TRAVIS_COMMIT, GITHUB_SHA). It reaches git as it would if they had typed it there. The finding is silenced inline, by its rule, saying so. No behaviour changes. For https://github.com/forkcloser/git-validation/issues/37. Co-Authored-By: Claude Fable 5.2 Signed-off-by: closer-claudio --- .lint-go.yaml | 3 +-- git/commits.go | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.lint-go.yaml b/.lint-go.yaml index ef0f9b8..847d3d4 100644 --- a/.lint-go.yaml +++ b/.lint-go.yaml @@ -90,8 +90,7 @@ golangci: - gocognit # 1 - revive # 1 - path: ^git/commits\.go$ - linters: # 16 findings - - gosec # 8 + linters: # 8 findings - varnamelen # 3 - gochecknoglobals # 2 - goconst # 2 diff --git a/git/commits.go b/git/commits.go index d1ebffa..0d1a62b 100644 --- a/git/commits.go +++ b/git/commits.go @@ -384,5 +384,8 @@ func ended(ctx context.Context, err error) error { func command(ctx context.Context, args ...string) *exec.Cmd { slog.DebugContext(ctx, "running git", "cmd", "git "+strings.Join(args, " ")) + // #nosec G204 -- the program is git; its arguments are this file's own subcommands, commits git named, and the + // range the operator gave, by --range or by their CI's variables (TRAVIS_COMMIT_RANGE, TRAVIS_COMMIT, GITHUB_SHA), + // which is theirs to give as it would be to git return exec.CommandContext(ctx, "git", args...) }