on master help sign in
Fix a security regression
8d0158cMichael Snoyman
warp-tls/Network/Wai/Handler/WarpTLS.hs+3−3
@@ -93,7 +93,6 @@ runTLSSocket :: TLSSettings -> Settings -> Socket -> Application -> IO ()
93runTLSSocket TLSSettings {..} set sock app = do
93runTLSSocket TLSSettings {..} set sock app = do
94 certs <- readCertificates certFile
94 certs <- readCertificates certFile
95 pk <- readPrivateKey keyFile
95 pk <- readPrivateKey keyFile
96− gen <- getSystemRandomGen
97 let params =
96 let params =
98 TLS.updateServerParams
97 TLS.updateServerParams
99 (\sp -> sp { TLS.serverWantClientCert = False }) $
98 (\sp -> sp { TLS.serverWantClientCert = False }) $
@@ -103,9 +102,9 @@ runTLSSocket TLSSettings {..} set sock app = do
103 , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing
102 , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing
104 , TLS.pLogging = tlsLogging
103 , TLS.pLogging = tlsLogging
105 }
104 }
106− runSettingsConnectionMaker set (getter gen params) app
105+ runSettingsConnectionMaker set (getter params) app
107 where
106 where
108− getter gen params = do
107+ getter params = do
109 (s, sa) <- acceptSafe sock
108 (s, sa) <- acceptSafe sock
110 let mkConn = do
109 let mkConn = do
111 (fromClient, firstBS) <- sourceSocket s C.$$+ CL.peek
110 (fromClient, firstBS) <- sourceSocket s C.$$+ CL.peek
@@ -118,6 +117,7 @@ runTLSSocket TLSSettings {..} set sock app = do
118 return bs
117 return bs
119 if maybe False ((== 0x16) . fst) (firstBS >>= B.uncons)
118 if maybe False ((== 0x16) . fst) (firstBS >>= B.uncons)
120 then do
119 then do
120+ gen <- getSystemRandomGen
121 ctx <- TLS.contextNew
121 ctx <- TLS.contextNew
122 TLS.Backend
122 TLS.Backend
123 { TLS.backendFlush = return ()
123 { TLS.backendFlush = return ()
warp-tls/warp-tls.cabal+1−1
@@ -1,5 +1,5 @@
1Name: warp-tls
1Name: warp-tls
2−Version: 1.4.1.1
2+Version: 1.4.1.2
3Synopsis: HTTP over SSL/TLS support for Warp via the TLS package
3Synopsis: HTTP over SSL/TLS support for Warp via the TLS package
4License: MIT
4License: MIT
5License-file: LICENSE
5License-file: LICENSE