Skip to content

fix(lint): re-enable the gosec G402 rule - #15540

Open
Coder-in-a-shell wants to merge 1 commit into
linkerd:mainfrom
Coder-in-a-shell:fix/reenable-g402-lint
Open

fix(lint): re-enable the gosec G402 rule#15540
Coder-in-a-shell wants to merge 1 commit into
linkerd:mainfrom
Coder-in-a-shell:fix/reenable-g402-lint

Conversation

@Coder-in-a-shell

Copy link
Copy Markdown

Problem

G402: TLS MinVersion too low has been excluded from gosec since #9693. The exclusion was explicitly temporary — the comment says to revert it once golangci-lint moved past v1.50.1, which brought in the gosec v2.13.1 → v2.14.0 fix for the false positive:

  # Temporarily disable this check until the next golang-ci upgrade (greater
  # than v1.50.1) which upgrades gosec from v2.13.1 to v2.14.0. ...
  - linters:
    - gosec
    text: "G402: TLS MinVersion too low"

That upgrade landed long ago. CI runs golangci-lint v1.64.8 (via ghcr.io/linkerd/dev:v50-go, which installs cmd/golangci-lint@latest), so the workaround is dead weight and a real TLS misconfiguration would currently go unreported.

Solution

Delete the exclusion. No code changes were needed.

Validation

Run with golangci-lint v1.64.8 to match the dev image.

1. Baseline on main — clean:

$ golangci-lint run --timeout=15m
(exit 0, no output)

2. With the exclusion removed — still clean, so there are no real G402 violations to fix:

$ golangci-lint run --timeout=15m
(exit 0, no output)

3. Confirmed the rule actually fires rather than the removal being a no-op. Temporarily added:

// pkg/tls/g402_probe.go
func TempProbe() *tls.Config {
	return &tls.Config{MinVersion: tls.VersionTLS10}
}
pkg/tls/g402_probe.go:7:10: G402: TLS MinVersion too low. (gosec)
	return &tls.Config{MinVersion: tls.VersionTLS10}
	        ^

4. Confirmed the exclusion was genuinely suppressing it — restoring the old config and re-running against the same probe reports nothing.

The probe file was removed before committing; the diff is the 8-line config deletion only.

Fixes #9700

Signed-off-by: Sudhir Jaiswal jaiswalsudhir2944@gmail.com

`G402: TLS MinVersion too low` was excluded in linkerd#9693 to work around a
gosec false positive, with the exclusion documented as temporary until
golangci-lint moved past v1.50.1 (gosec v2.13.1 -> v2.14.0).

That upgrade happened long ago -- CI now runs golangci-lint v1.64.8 via
the `ghcr.io/linkerd/dev:v50-go` image -- so the workaround is obsolete.

Removes the exclusion. No code changes are needed: linting the tree with
the rule re-enabled reports no G402 findings.

Fixes linkerd#9700

Signed-off-by: Sudhir Jaiswal <jaiswalsudhir2944@gmail.com>
@Coder-in-a-shell
Coder-in-a-shell requested a review from a team as a code owner July 29, 2026 09:44
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.

Re-enable "G402: TLS MinVersion too low" lint rule

3 participants