Skip to content

Commit

Permalink
tweak test
Browse files Browse the repository at this point in the history
  • Loading branch information
Daisuke Maki committed Feb 24, 2025
1 parent f6b501d commit 9fed07c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jws/jws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1703,10 +1703,6 @@ func TestGH681(t *testing.T) {
func TestGH840(t *testing.T) {
// Go 1.19+ panics if elliptic curve operations are called against
// a point that's _NOT_ on the curve
// As of go1.24.0, generating a signature with a private key that has
// X/Y that's not on the curve will fail, but all go < 1.24 will succeed.
// Instead of checking the version, we'll just check if the operation fails,
// and if it does we won't run the check for jwt.Parse
untrustedJWK := []byte(`{
"kty": "EC",
"crv": "P-256",
Expand All @@ -1728,9 +1724,14 @@ func TestGH840(t *testing.T) {
Build()
require.NoError(t, err, `jwt.NewBuilder should succeed`)

// As of go1.24.0, generating a signature with a private key that has
// X/Y that's not on the curve will fail, but all go < 1.24 will succeed.
// Instead of checking the version, we'll just check if the operation fails,
// and if it does we won't run the check for jwt.Parse
signed, err := jwt.Sign(tok, jwt.WithKey(jwa.ES256(), privkey))
if err != nil {
require.Error(t, err, `jwt.Sign should fail`)
return
}
require.NoError(t, err, `jwt.Sign should succeed`)

Expand Down

0 comments on commit 9fed07c

Please sign in to comment.