Conversation
PR SummaryMedium Risk Overview Adds runtime-backed session-token revocation: sessions now generate/persist Reviewed by Cursor Bugbot for commit 03b97ea. Bugbot is set up for automated code reviews on this repo. Configure here. |
| RegisteredClaims: jwt.RegisteredClaims{ | ||
| ExpiresAt: jwt.NewNumericDate(session.ExpiresAt), | ||
| IssuedAt: jwt.NewNumericDate(session.CreatedAt), | ||
| NotBefore: jwt.NewNumericDate(session.CreatedAt.Add(-m.clockSkew)), |
There was a problem hiding this comment.
Double clock skew applied to nbf claim
Low Severity
The nbf claim in Sign is set to session.CreatedAt.Add(-m.clockSkew), which already subtracts the clock skew. Then Verify applies jwt.WithLeeway(m.clockSkew), which adds another clockSkew tolerance to the nbf check. The golang-jwt library validates nbf as now >= nbf - leeway, so the effective check becomes now >= CreatedAt - 2*clockSkew. With the default 30-second clockSkew, tokens are accepted starting 60 seconds before creation rather than the intended 30. The nbf value passed to Sign likely just needs to be session.CreatedAt, letting the leeway handle clock skew uniformly across all time claims.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c85cb17. Configure here.
There was a problem hiding this comment.
Bugbot Autofix determined this is a false positive.
Verify also enforces iat with the same leeway, so tokens still cannot be accepted before CreatedAt - clockSkew even though nbf is backdated.
You can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 03b97ea. Configure here.
| manager.clockSkew = clockSkew | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Exported WithClockSkew option is never used
Low Severity
WithClockSkew is an exported Option function that is defined but never called anywhere in the codebase — not in production code, bootstrap wiring, or tests. It's dead code introduced in this PR.
Reviewed by Cursor Bugbot for commit 03b97ea. Configure here.


Summary
jti,nbf, andissclaims to ASB session JWTs and validate them on verifyCloses #6
Validation
go test ./internal/crypto/sessionjwt ./internal/store/memory ./internal/store/redis ./internal/app -count=1go test ./... -count=1go test ./... -race -count=1GOTOOLCHAIN=go1.26.0 go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.3 run --timeout=5m ./...go run github.com/securego/gosec/v2/cmd/gosec@v2.22.4 ./cmd/... ./internal/...