Skip to content

ci(lint): add golangci-lint across all modules (stacked on #20) - #21

Merged
terraboops merged 2 commits into
mainfrom
ci/golangci-lint
Sep 28, 2026
Merged

terraboops merged 2 commits into
mainfrom
ci/golangci-lint

Conversation

@terraboops

Copy link
Copy Markdown
Contributor

What

Adds a lint job to CI running golangci-lint v2.11.4 over all three modules, with a root .golangci.yml. CI already had two fuzzers, govulncheck, gitleaks, a stdlib-only gate, and load/benchmark-regression gates — golangci-lint was the gap.

Config (.golangci.yml)

Standard set (errcheck, govet, ineffassign, staticcheck, unused), tuned to stay green on real defects:

  • std-error-handling preset — unactionable Close / Fprintln / response-write errors.
  • errcheck relaxed in _test.go (a failed setup call fails the test anyway); strict elsewhere.
  • QF* refactor "quick fixes" left off (style, not correctness); the ST* doc/naming checks mirror golangci-lint's own defaults. All SA* bug checks run everywhere.

Real findings fixed here (both keys_test.go)

  • SA5011 — a possible nil-pointer dereference after a non-fatal nil check → now t.Fatal.
  • ineffassign — an ineffectual assignment → blank identifier.

The 14 errcheck / QF / ST items that remained were unactionable or stylistic (see the config comments); nothing in production code was a defect.

Stacked on #20

The SA1019 (IsOnCurve) deprecation this config would otherwise flag is fixed in #20, so this PR is based on harden/ecdsa-parseuncompressed, not main. Retarget to main once #20 lands. All three modules lint clean locally with this config.

Review-only — please do not merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SDfMmeRXGsanqzDDSjL1uU

terraboops and others added 2 commits September 27, 2026 23:18
…dPublicKey

Both places that reconstruct a P-256 public key from JWK x/y coordinates built
an ecdsa.PublicKey by hand and validated it with elliptic.Curve.IsOnCurve,
deprecated since Go 1.21 (SA1019). The use was sound — a public point, a
boolean on-curve test, no secret — but the stdlib now does this better.

Route both through keys.PublicFromXY, which builds the SEC 1 uncompressed
encoding and calls ecdsa.ParseUncompressedPublicKey (Go 1.25+). That rejects an
off-curve point and the point at infinity in one validated step, removes the
deprecated API, and drops verifier/remote.go's duplicate decode so there is one
source of truth. Coordinates are left-padded to the 32 bytes P-256 requires
(tolerating a stripped leading zero) and an over-long coordinate is rejected.

Tests: a valid key round-trips; the minimal (stripped) encoding parses; an
off-curve point, the point at infinity, an over-long coordinate, and a
non-base64url coordinate are each rejected.

Review-only; not for merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SDfMmeRXGsanqzDDSjL1uU
…ules

CI had two fuzzers, govulncheck, gitleaks, a stdlib-only gate, load and
benchmark-regression gates — but no golangci-lint, so errcheck/ineffassign/
staticcheck findings went unseen.

Add a lint job that runs golangci-lint (v2.11.4) over all three modules, plus a
.golangci.yml that enables the standard set (errcheck, govet, ineffassign,
staticcheck, unused) tuned to stay green on real defects: the std-error-handling
preset for unactionable Close/Fprintln/response-write errors, errcheck relaxed
in _test.go, and the QF* refactor "quick fixes" left off (style, not
correctness). The SA* bug checks run everywhere.

Two real findings surfaced and fixed here (both in keys_test.go): a possible
nil-pointer dereference after a non-fatal nil check (SA5011), now t.Fatal; and
an ineffectual assignment, now a blank identifier. The SA1019 deprecation this
config would otherwise flag is fixed in the parent commit.

Review-only; not for merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SDfMmeRXGsanqzDDSjL1uU
@terraboops
terraboops changed the base branch from harden/ecdsa-parseuncompressed to main September 28, 2026 07:06
@terraboops
terraboops merged commit 75b47cd into main Sep 28, 2026
6 checks passed
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.

1 participant