all: migrate from go-jose/v2 to go-jose/v4#162
all: migrate from go-jose/v2 to go-jose/v4#162piersdd wants to merge 1 commit intotailscale:mainfrom
Conversation
|
Something perhaps worthwhile to mention as well: go.sum cleanup is a secondary positive effect. go-jose/v2 leaked testify, go-difflib, and go-spew into the module graph as transitive test dependencies. Removing those is a nice bonus. |
|
Something else potentially worth noting and acknowledging: |
|
please also update your commit with the DCO. |
gopkg.in/square/go-jose.v2 is unmaintained. The canonical library is now github.com/go-jose/go-jose/v4. This is a mostly mechanical import path migration with two API changes: 1. jwt.ParseSigned() now requires an explicit []SignatureAlgorithm parameter for algorithm allowlisting — a security improvement that prevents algorithm confusion attacks. 2. jwt.Signed().Claims().CompactSerialize() is now Serialize(). 3. go-jose/v4 serializes single-element JWT audiences as a string per RFC 7519 (v2 always used an array). Updated test assertions to handle both representations. Signed-off-by: Piers Dawson-Damer <piers@groupthink.asia>
fb9b9a4 to
9cb4078
Compare
Summary
gopkg.in/square/go-jose.v2is unmaintained. The canonical library is nowgithub.com/go-jose/go-jose/v4.This is a mostly mechanical import path migration across 6 source files with three notable API changes in v4:
jwt.ParseSigned()requires explicit algorithm allowlisting — callers must pass[]jose.SignatureAlgorithm{jose.RS256}. This is a security improvement that prevents algorithm confusion attacks.CompactSerialize()→Serialize()— renamed in v4.Single-element
audserialised as string — go-jose/v4 follows RFC 7519 and serialises a single-element audience as a JSON string rather than a one-element array. Updated theTestAZPClaimWithMultipleAudiencestest to handle both representations.Files changed
go.mod/go.sumserver/server.goserver/token.goSerialize()renameserver/oauth-metadata.goserver/token_test.goParseSignedalgorithm param + audience assertionserver/helpers_test.goserver/extraclaims_test.goNo changes to
cmd/verifier/verifier.go(uses stdlib crypto) orserver/server_test.go(no go-jose imports).Test plan
go build ./...passesgo test ./...passes (all existing tests)go vet ./...cleangofmt -l .produces no output