From 6930327bb85badd7e58557b079df055631918bf0 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Tue, 16 Jul 2024 11:42:38 +0100 Subject: [PATCH 1/5] quiet warning about cabal-version The >= syntax is deprecated. Putting the line as the first line in the file is not strictly necessary for 1.16, but it is allegedly necessary as of 2.2 and harmless before then. https://cabal.readthedocs.io/en/stable/cabal-package-description-file.html#pkg-field-cabal-version --- jwt.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jwt.cabal b/jwt.cabal index f4619c2..6c72433 100644 --- a/jwt.cabal +++ b/jwt.cabal @@ -1,3 +1,4 @@ +cabal-version: 1.16 -- Initial atlassian-jwt.cabal generated by cabal init. For further -- documentation, see http://haskell.org/cabal/users-guide/ @@ -12,7 +13,6 @@ homepage: https://github.com/puffnfresh/haskell-jwt bug-reports: https://github.com/puffnfresh/haskell-jwt/issues category: Web build-type: Simple -cabal-version: >=1.16 description: JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred between two parties. From 343b13c7994abf9f9bbc1f6949bb058498350124 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Tue, 16 Jul 2024 11:45:55 +0100 Subject: [PATCH 2/5] Use crypton instead of cryptonite This also requires updating dependencies to use crypton. Unfortunately, cryptostore will only use crypton if the use_crypton Cabal flag is enabled, and we can't make that happen from our cabal file. I opened an issue to ask them to remove `manual: True` from their flag, so that the solver can try enabling it. See: https://github.com/ocheron/cryptostore/issues/13 --- jwt.cabal | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jwt.cabal b/jwt.cabal index 6c72433..167826b 100644 --- a/jwt.cabal +++ b/jwt.cabal @@ -33,7 +33,7 @@ library exposed-modules: Web.JWT other-modules: Data.Text.Extended, Data.ByteString.Extended build-depends: base >= 4.8 && < 5 - , cryptonite >= 0.6 + , crypton >= 0.31 , cryptostore >= 0.2 , memory >= 0.8 , bytestring >= 0.10 @@ -47,8 +47,8 @@ library , vector >= 0.7.1 , semigroups >= 0.15.4 , network-uri - , x509 - , x509-store + , crypton-x509 + , crypton-x509-store hs-source-dirs: src default-language: Haskell2010 @@ -81,7 +81,7 @@ test-suite testsuite , lens , HUnit , QuickCheck >= 2.4.0.1 - , cryptonite + , crypton , cryptostore , memory , bytestring >= 0.10 @@ -95,8 +95,8 @@ test-suite testsuite , vector >= 0.7.1 , semigroups >= 0.15.4 , network-uri - , x509 - , x509-store + , crypton-x509 + , crypton-x509-store cpp-options: -DTEST From 5dfe06f3a9c791107a30ddcab7c29a0f8eb7f44d Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Tue, 16 Jul 2024 12:25:24 +0100 Subject: [PATCH 3/5] work around cryptostore flag issue --- .github/workflows/haskell.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 2181048..1fb4039 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -35,6 +35,9 @@ jobs: cabal update cabal build --only-dependencies --enable-tests --enable-benchmarks - name: Build - run: cabal build --enable-tests --enable-benchmarks all + # We can't really keep this constraint here, since users aren't going to + # know they need to specify it. But we can at least have it to check that + # getting the flag specified is the only blocker to a successful build. + run: cabal build --enable-tests --enable-benchmarks all --constraint="cryptostore +use_crypton" - name: Run tests run: cabal test test:testsuite From f2783c7ac1d2f181551c23a0cc0f68508f0617f0 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Tue, 16 Jul 2024 12:42:42 +0100 Subject: [PATCH 4/5] fix tests on newer aeson --- tests/src/Web/JWTInteropTests.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/Web/JWTInteropTests.hs b/tests/src/Web/JWTInteropTests.hs index c25d754..7d1183c 100644 --- a/tests/src/Web/JWTInteropTests.hs +++ b/tests/src/Web/JWTInteropTests.hs @@ -54,9 +54,9 @@ prop_encode_decode_sub = shouldBeMaybeStringOrUri "sub" sub prop_encode_decode_iss :: JWTClaimsSet -> Bool prop_encode_decode_iss = shouldBeMaybeStringOrUri "iss" iss -shouldBeMaybeStringOrUri :: ToJSON a => T.Text -> (a -> Maybe StringOrURI) -> a -> Bool -shouldBeMaybeStringOrUri key' f claims' = - let json = toJSON claims' ^? key key' +shouldBeMaybeStringOrUri :: ToJSON a => String -> (a -> Maybe StringOrURI) -> a -> Bool +shouldBeMaybeStringOrUri key' f claims' = + let json = toJSON claims' ^? key (fromString key') in json == (fmap (String . stringOrURIToText) $ f claims') prop_encode_decode_aud :: JWTClaimsSet -> Bool From 8348a67eb4834cfb409686fa2e5b4335d9f8b290 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Tue, 16 Jul 2024 13:16:53 +0100 Subject: [PATCH 5/5] try fixing tests in CI --- .github/workflows/haskell.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 1fb4039..7d8c1da 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -40,4 +40,5 @@ jobs: # getting the flag specified is the only blocker to a successful build. run: cabal build --enable-tests --enable-benchmarks all --constraint="cryptostore +use_crypton" - name: Run tests - run: cabal test test:testsuite + # as above + run: cabal test test:testsuite --constraint="cryptostore +use_crypton"