Repository navigation
ci(lint): add golangci-lint across all modules (stacked on #20) - #21
Merged
Merged
Conversation
…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
changed the base branch from
harden/ecdsa-parseuncompressed
to
main
September 28, 2026 07:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
lintjob 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-handlingpreset — unactionableClose/Fprintln/ response-write errors.errcheckrelaxed in_test.go(a failed setup call fails the test anyway); strict elsewhere.QF*refactor "quick fixes" left off (style, not correctness); theST*doc/naming checks mirror golangci-lint's own defaults. AllSA*bug checks run everywhere.Real findings fixed here (both
keys_test.go)nilcheck → nowt.Fatal.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 onharden/ecdsa-parseuncompressed, notmain. Retarget tomainonce #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