crypton-x509 1.10.1 → 1.10.2
raw patch · 4 files changed
+28/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- Data/X509/Ext.hs +14/−1
- Tests/Tests.hs +8/−3
- crypton-x509.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,10 @@ # ChangeLog for crypton-x509 +## 1.10.2++* Reject iPAddress GeneralNames of invalid length in SubjectAltName+ (4 or 16 bytes) and NameConstraints (8 or 32 bytes).+ ## 1.10.1 * Decoding functions return `Left` instead of throwing on malformed
Data/X509/Ext.hs view
@@ -297,7 +297,14 @@ -- | GeneralName types that 'AltName' cannot represent are skipped. parseGeneralNames :: ParseASN1 [AltName]-parseGeneralNames = onNextContainer Sequence $ catMaybes <$> getMany getAddrMaybe+parseGeneralNames = onNextContainer Sequence $ do+ names <- catMaybes <$> getMany getAddrMaybe+ forM_ names $ \name -> case name of+ AltNameIP ip+ | B.length ip /= 4 && B.length ip /= 16 ->+ throwParseError "GeneralNames: invalid iPAddress length"+ _ -> return ()+ return names -- | Fails on GeneralName types that 'AltName' cannot represent. getAddr :: ParseASN1 AltName@@ -519,6 +526,12 @@ -> Either String (GeneralSubtree, [ASN1]) decodeGeneralSubtree (Start Sequence : xs) = do (base, rest1) <- runParseASN1State getAddr xs+ -- an iPAddress constraint is an address followed by a mask+ case base of+ AltNameIP ip+ | B.length ip /= 8 && B.length ip /= 32 ->+ Left "GeneralSubtree: invalid iPAddress length"+ _ -> Right () (minimum', rest2) <- case rest1 of (Other Context 0 bs : rs) -> (\n -> (n, rs)) <$> implicitInt bs
Tests/Tests.hs view
@@ -344,7 +344,8 @@ -- different values, because they are three different files. property_mldsa_forms :: MLDSASeed -> Bool property_mldsa_forms (MLDSASeed seed) =- map (fmap fst . mldsaPKCS8 . snd) (mldsaForms seed) == map (Right . expected) forms+ map (fmap fst . mldsaPKCS8 . snd) (mldsaForms seed)+ == map (Right . expected) forms && length (nub (map expected forms)) == 3 where forms = map fst (mldsaForms seed)@@ -460,7 +461,7 @@ [ AltNameDNS <$> arbitraryHost , AltNameRFC822 . ("user@" ++) <$> arbitraryHost , AltNameURI . ("https://" ++) <$> arbitraryHost- , AltNameIP . B.pack <$> (elements [4, 8, 16, 32] >>= vector)+ , AltNameIP . B.pack <$> (elements [4, 16] >>= vector) , AltNameDN <$> arbitrary ] where@@ -469,9 +470,13 @@ instance Arbitrary GeneralSubtree where arbitrary = GeneralSubtree- <$> arbitrary+ <$> (arbitrary >>= base) <*> pure 0 <*> oneof [pure Nothing, Just <$> choose (0, 300)]+ where+ -- an address with a mask+ base (AltNameIP _) = AltNameIP . B.pack <$> (elements [8, 32] >>= vector)+ base a = return a instance Arbitrary ExtNameConstraints where arbitrary = ExtNameConstraints <$> arbitrary <*> arbitrary
crypton-x509.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: crypton-x509-version: 1.10.1+version: 1.10.2 license: BSD3 license-file: LICENSE copyright: Vincent Hanquez <vincent@snarc.org>