From 9fed07ca1df3c129ea92525be63e336121cad2af Mon Sep 17 00:00:00 2001 From: Daisuke Maki Date: Mon, 24 Feb 2025 17:33:08 +0900 Subject: [PATCH] tweak test --- jws/jws_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jws/jws_test.go b/jws/jws_test.go index 411d920f..cc078479 100644 --- a/jws/jws_test.go +++ b/jws/jws_test.go @@ -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", @@ -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`)