-
Release v1.0.2 Stable
released this
2026-05-18 14:39:23 -06:00 | 0 commits to main since this releasev1.0.2
code.nochebuena.dev/go/httpauth-jwtOverview
v1.0.2 adds
jwt.WithJSONNumber()to allVerifyimplementations, standardizes
AuthMiddlewareerror responses to JSON, and bumps thehttpauthdependency to
v1.0.2 to consume wildcard resource fallback, json.Number precision handling, and
the sharedWriteJSONErrorhelper.No breaking changes. All v1.0.x consumers can upgrade with
go get.What Changed Since v1.0.1
jwt.WithJSONNumber() in all Verify implementations
All three
Verifyimplementations now passjwt.WithJSONNumber()tojwt.Parse:hmacSigner.VerifyrsaSigner.VerifyrsaPublicVerifier.Verify
Without this option, the JWT library decodes all numbers as
float64.float64
cannot representmath.MaxInt64 = 9223372036854775807exactly — it rounds to2^63 = 9223372036854775808, which overflows back tomath.MinInt64when cast toint64.
This would corrupt theADMINwildcard permission mask stored in JWT claims.With
jwt.WithJSONNumber(), numbers are preserved asjson.Number(a decimal string
wrapper).json.Number.Int64()parses the exact value — no float64 round-trip, no
overflow.httpauth.ClaimsPermissionProvider(v1.0.2) handles all three types —
int64,float64,json.Number— so the chain is fully covered.JSON error body in AuthMiddleware
AuthMiddlewarenow returns a structured JSON body for all 401 responses by calling
httpauth.WriteJSONError. Previously it calledhttp.Errorwhich writestext/plain.The full middleware stack now produces consistent error responses:
Middleware Condition Status Code AuthMiddlewareMissing/invalid/expired token 401 UNAUTHENTICATEDEnrichmentMiddlewareNo uid in context 401 UNAUTHENTICATEDEnrichmentMiddlewareEnricher returns error 500 INTERNALAuthzMiddlewareNo identity in context 401 UNAUTHENTICATEDAuthzMiddlewarePermission denied or provider error 403 PERMISSION_DENIEDDependency bump
code.nochebuena.dev/go/httpauth v1.0.1 → v1.0.2Migration
No breaking changes. Callers that inspect decoded JWT claims should note that numeric
values now come back asjson.Numberinstead offloat64.go get code.nochebuena.dev/go/httpauth-jwt@v1.0.2 go get code.nochebuena.dev/go/httpauth@v1.0.2Downloads