Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: replace github.com/go-jose/go-jose/v3 with v4#16031

Merged
Emyrk merged 1 commit into
coder:mainfrom
Juneezee:go-jose
Jan 3, 2025
Merged

chore: replace github.com/go-jose/go-jose/v3 with v4#16031
Emyrk merged 1 commit into
coder:mainfrom
Juneezee:go-jose

Conversation

@Juneezee
Copy link
Copy Markdown
Contributor

@Juneezee Juneezee commented Jan 3, 2025

coder/go.mod

Lines 125 to 126 in 4495db8

github.com/go-jose/go-jose/v3 v3.0.3
github.com/go-jose/go-jose/v4 v4.0.2

Our codebase currently uses both v3 and v4 versions of the go-jose dependency. To maintain consistency, we should standardize on using only the latest v4 version.

Our codebase currently uses both v3 and v4 versions of the `go-jose`
dependency. To maintain consistency, we should standardize on using only
the latest v4 version.

Signed-off-by: Eng Zer Jun <[email protected]>
@cdr-bot cdr-bot Bot added the community Pull Requests and issues created by the community. label Jan 3, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 3, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Juneezee
Copy link
Copy Markdown
Contributor Author

Juneezee commented Jan 3, 2025

I have read the CLA Document and I hereby sign the CLA

cdrci2 added a commit to coder/cla that referenced this pull request Jan 3, 2025
Copy link
Copy Markdown
Contributor Author

@Juneezee Juneezee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explaining my changes

require.Equal(t, appTokenCookie.Path, u.Path, "incorrect path on app token cookie")

object, err := jose.ParseSigned(appTokenCookie.Value)
object, err := jose.ParseSigned(appTokenCookie.Value, []jose.SignatureAlgorithm{jwtutils.SigningAlgo})
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only breaking change that affects us. In v4, jose.ParseSigned requires specifying the algorithms used to sign the signature.

https://github.com/go-jose/go-jose/blob/main/CHANGELOG.md#v400

Comment thread coderd/jwtutils/jws.go

const (
signingAlgo = jose.HS512
SigningAlgo = jose.HS512
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I exported this constant variable for the jose.ParseSigned function calls in coderd/workspaceapps/apptest/apptest.go. See the previous review comment.

@Juneezee Juneezee marked this pull request as ready for review January 3, 2025 17:02
Copy link
Copy Markdown
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

We used v4 in prod, and v3 in tests it seems.

@Emyrk Emyrk merged commit d788223 into coder:main Jan 3, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community Pull Requests and issues created by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants