Skip to content

Fix gosec lint failures: G115, G706, G703#153

Merged
pjbgf merged 2 commits intorenovate/golangci-golangci-lint-2.xfrom
copilot/fix-lint-issues
Feb 25, 2026
Merged

Fix gosec lint failures: G115, G706, G703#153
pjbgf merged 2 commits intorenovate/golangci-golangci-lint-2.xfrom
copilot/fix-lint-issues

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

make verify was failing due to 5 gosec violations across three files. Fixes suppress legitimate false positives (trusted env vars, fd-to-int casts) and refactors log calls to use structured fields instead of interpolated messages.

Changes

  • G115 (profiles.go): Suppress integer overflow warning on int(os.Stdout.Fd()) — fd values are always safe to cast to int
  • G706 (profiles.go, docker/run.go, podman/run.go): Replace slog.Debug(fmt.Sprintf("exec: %s", bin), ...) with structured slog.Debug("exec", "binary", bin, ...) to avoid tainted data in the log message; suppress remaining instance where xauthority env var appears as a log field
  • G703 (profiles.go): Suppress path traversal warning on os.Open(xauthority) — path is sourced from the user's own $XAUTHORITY env var
// Before
slog.Debug(fmt.Sprintf("exec: %s", runnerBinary), "args", args)

// After
slog.Debug("exec", "binary", runnerBinary, "args", args) //nolint:gosec // G706: binary path is from trusted config

Also includes regenerated proto files (host.pb.go, host_grpc.pb.go) that were stale relative to the .proto source, causing verify-dirty to fail.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pjbgf <5452977+pjbgf@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lint errors in profile and runner packages Fix gosec lint failures: G115, G706, G703 Feb 25, 2026
Copilot AI requested a review from pjbgf February 25, 2026 10:44
@pjbgf pjbgf marked this pull request as ready for review February 25, 2026 10:50
@pjbgf pjbgf merged commit bd5c566 into renovate/golangci-golangci-lint-2.x Feb 25, 2026
5 checks passed
@pjbgf pjbgf deleted the copilot/fix-lint-issues branch February 25, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants