Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-tls-session-manager for
openSUSE:Factory checked in at 2026-11-27 19:45:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-tls-session-manager (Old)
and /work/SRC/openSUSE:Factory/.ghc-tls-session-manager.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-tls-session-manager"
Fri Nov 27 19:45:11 2026 rev:15 rq:1401158 version:0.1.4
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-tls-session-manager/ghc-tls-session-manager.changes
2026-11-24 12:43:17.940330826 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-tls-session-manager.new.1340718/ghc-tls-session-manager.changes
2026-11-27 19:49:29.863231500 +0100
@@ -1,0 +2,24 @@
+Tue Nov 24 07:46:03 UTC 2026 - Peter Simons <[email protected]>
+
+- Update tls-session-manager to version 0.1.4.
+ ## 0.1.4
+
+ * Never wrap around the RTT of a ticket, and cap it at 10 seconds.
+ [#661](https://github.com/haskell-tls/hs-tls/pull/661)
+
+-------------------------------------------------------------------
+Fri Nov 20 07:08:52 UTC 2026 - Peter Simons <[email protected]>
+
+- Update tls-session-manager to version 0.1.3.
+ ## 0.1.3
+
+ * Refuse a replayed 0-RTT ticket in the session ticket manager.
+ [#634](https://github.com/haskell-tls/hs-tls/pull/634)
+
+-------------------------------------------------------------------
+Fri Nov 20 04:16:30 UTC 2026 - Peter Simons <[email protected]>
+
+- Update tls-session-manager to version 0.1.2 revision 1.
+ Upstream has revised the Cabal build instructions on Hackage.
+
+-------------------------------------------------------------------
Old:
----
tls-session-manager-0.1.2.tar.gz
New:
----
tls-session-manager-0.1.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-tls-session-manager.spec ++++++
--- /var/tmp/diff_new_pack.MAmmkm/_old 2026-11-27 19:49:31.157286443 +0100
+++ /var/tmp/diff_new_pack.MAmmkm/_new 2026-11-27 19:49:31.165286783 +0100
@@ -20,7 +20,7 @@
%bcond_with ghc_prof
%bcond_with tests
Name: ghc-%pkg_name
-Version: 0.1.2
+Version: 0.1.4
Release: 0
%global pkgver %pkg_name-%{version}
Summary: In-memory TLS session DB and session ticket
++++++ tls-session-manager-0.1.2.tar.gz -> tls-session-manager-0.1.4.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tls-session-manager-0.1.2/ChangeLog.md
new/tls-session-manager-0.1.4/ChangeLog.md
--- old/tls-session-manager-0.1.2/ChangeLog.md 2001-09-09 03:46:40.000000000
+0200
+++ new/tls-session-manager-0.1.4/ChangeLog.md 2001-09-09 03:46:40.000000000
+0200
@@ -1,5 +1,15 @@
# ChangeLog for tls-session-manager
+## 0.1.4
+
+* Never wrap around the RTT of a ticket, and cap it at 10 seconds.
+ [#661](https://github.com/haskell-tls/hs-tls/pull/661)
+
+## 0.1.3
+
+* Refuse a replayed 0-RTT ticket in the session ticket manager.
+ [#634](https://github.com/haskell-tls/hs-tls/pull/634)
+
## 0.1.2
* Require tls >= 2.4.13 and build the tests with `defaultSessionData`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/tls-session-manager-0.1.2/Network/TLS/SessionTicket.hs
new/tls-session-manager-0.1.4/Network/TLS/SessionTicket.hs
--- old/tls-session-manager-0.1.2/Network/TLS/SessionTicket.hs 2001-09-09
03:46:40.000000000 +0200
+++ new/tls-session-manager-0.1.4/Network/TLS/SessionTicket.hs 2001-09-09
03:46:40.000000000 +0200
@@ -2,11 +2,8 @@
-- | A manager for TLS 1.2/1.3 session ticket.
--
--- Tracking client hello is not implemented yet.
--- So, if this is used for TLS 1.3 0-RTT,
--- replay attack is possible.
--- If your application data in 0-RTT changes the status of server side,
--- use 'Network.TLS.SessionManager' instead.
+-- For TLS 1.3 0-RTT, a ticket is accepted at most once while a replay
+-- of its ClientHello could still be fresh.
--
-- A dedicated thread is running repeatedly to replece
-- secret keys. So, energy saving is not achieved.
@@ -22,8 +19,12 @@
import Codec.Serialise
import qualified Crypto.Token as CT
import qualified Data.ByteString.Lazy as L
+import Data.IORef
+import Data.Int (Int64)
+import qualified Data.OrdPSQ as Q
import Network.TLS
import Network.TLS.Internal
+import System.Clock
-- | Configuration for session tickets.
data Config = Config
@@ -47,7 +48,7 @@
-- | Creating a session ticket manager.
newSessionTicketManager :: Config -> IO SessionManager
newSessionTicketManager Config{..} =
- sessionTicketManager <$> CT.spawnTokenManager conf
+ sessionTicketManager <$> CT.spawnTokenManager conf <*> newIORef Q.empty
where
conf =
CT.defaultConfig
@@ -59,7 +60,8 @@
newSessionTicketManager' :: Config -> IO (SessionManager, IO ())
newSessionTicketManager' Config{..} = do
tokenmgr <- CT.spawnTokenManager conf
- return (sessionTicketManager tokenmgr, CT.killTokenManager tokenmgr)
+ used <- newIORef Q.empty
+ return (sessionTicketManager tokenmgr used, CT.killTokenManager tokenmgr)
where
conf =
CT.defaultConfig
@@ -68,11 +70,15 @@
, CT.threadName = "TLS ticket manager"
}
-sessionTicketManager :: CT.TokenManager -> SessionManager
-sessionTicketManager ctmgr =
+-- | Tickets used for 0-RTT, with when they may be forgotten in
+-- milliseconds of the wall clock.
+type Used = IORef (Q.OrdPSQ Ticket Int64 ())
+
+sessionTicketManager :: CT.TokenManager -> Used -> SessionManager
+sessionTicketManager ctmgr used =
noSessionManager
{ sessionResume = resume ctmgr
- , sessionResumeOnlyOnce = resume ctmgr
+ , sessionResumeOnlyOnce = resumeOnlyOnce ctmgr used
, sessionEstablish = establish ctmgr
, sessionInvalidate = \_ -> return ()
, sessionUseTicket = True
@@ -93,3 +99,32 @@
Left _ -> return Nothing
Right sd -> return $ Just sd
| otherwise = return Nothing
+
+-- A replay has the same age, so the same expected arrival time E, which is
+-- within the tolerance of the first use. The server accepts it only within
+-- the tolerance of E, so the ticket is remembered for twice the tolerance.
+resumeOnlyOnce :: CT.TokenManager -> Used -> Ticket -> IO (Maybe SessionData)
+resumeOnlyOnce ctmgr used ticket = do
+ msd <- resume ctmgr ticket
+ case msd of
+ Nothing -> return Nothing
+ Just sd -> do
+ now <- milliseconds
+ -- Capped at 10 seconds as in the server, before it can wrap
+ -- around as an Int64.
+ let rtt = maybe 0 (fromIntegral . min 10000) $ sessionTicketInfo
sd >>= estimatedRTT
+ -- 'max 2000 rtt' as in the server, and a second of margin
+ forget = now + 2 * max 2000 rtt + 1000
+ first <- atomicModifyIORef' used $ \q ->
+ let q' = snd $ Q.atMostView now q
+ in case Q.lookup ticket q' of
+ Just _ -> (q', False)
+ Nothing -> (Q.insert ticket forget () q', True)
+ return $ if first then Just sd else Nothing
+
+-- The wall clock, as the server checks freshness with it. If it goes
+-- back, the ticket is remembered longer, just as a replay stays fresh.
+milliseconds :: IO Int64
+milliseconds = do
+ TimeSpec s ns <- getTime Realtime
+ return $ s * 1000 + ns `div` 1000000
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tls-session-manager-0.1.2/test/SessionManagerSpec.hs
new/tls-session-manager-0.1.4/test/SessionManagerSpec.hs
--- old/tls-session-manager-0.1.2/test/SessionManagerSpec.hs 2001-09-09
03:46:40.000000000 +0200
+++ new/tls-session-manager-0.1.4/test/SessionManagerSpec.hs 2001-09-09
03:46:40.000000000 +0200
@@ -17,6 +17,8 @@
cons,
toValue,
)
+import Network.TLS.SessionTicket (newSessionTicketManager')
+import qualified Network.TLS.SessionTicket as SessionTicket
import Test.Hspec
spec :: Spec
@@ -52,6 +54,28 @@
_ <- sessionEstablish mgr "a" $ sessionData Nothing
sessionResumeOnlyOnce mgr "a" >>= (`shouldSatisfy` isJust)
sessionResumeOnlyOnce mgr "a" >>= (`shouldSatisfy` isNothing)
+ describe "newSessionTicketManager" $ do
+ it "resumes a ticket only once for 0-RTT while a replay is fresh" $ do
+ (mgr, kill) <- newSessionTicketManager' SessionTicket.defaultConfig
+ Just ticket <- sessionEstablish mgr "" $ sessionData (Just 3600)
+ sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isJust)
+ sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isNothing)
+ sessionResume mgr ticket >>= (`shouldSatisfy` isJust)
+ -- twice the tolerance of 2 seconds and a second of margin
+ threadDelay 5100000
+ sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isJust)
+ kill
+ it "remembers a ticket with a wrapped RTT as long as with a capped
one" $ do
+ (mgr, kill) <- newSessionTicketManager' SessionTicket.defaultConfig
+ let wrapped t = t{estimatedRTT = Just (maxBound - 4)}
+ sd = sessionData (Just 3600)
+ Just ticket <-
+ sessionEstablish mgr "" sd{sessionTicketInfo = wrapped <$>
sessionTicketInfo sd}
+ sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isJust)
+ -- beyond the 5 seconds for an RTT within 2 seconds
+ threadDelay 5100000
+ sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isNothing)
+ kill
-- While the reaper prunes, the sessions are taken away and an empty
-- workload is left in their place; the pruned ones are merged back.
describe "pruning" $ do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tls-session-manager-0.1.2/tls-session-manager.cabal
new/tls-session-manager-0.1.4/tls-session-manager.cabal
--- old/tls-session-manager-0.1.2/tls-session-manager.cabal 2001-09-09
03:46:40.000000000 +0200
+++ new/tls-session-manager-0.1.4/tls-session-manager.cabal 2001-09-09
03:46:40.000000000 +0200
@@ -1,6 +1,6 @@
cabal-version: 2.0
name: tls-session-manager
-version: 0.1.2
+version: 0.1.4
license: BSD3
license-file: LICENSE
maintainer: [email protected]
@@ -29,7 +29,7 @@
psqueues >= 0.2 && < 0.3,
ram,
serialise >= 0.2 && < 0.3,
- tls >= 2.4.13 && < 2.6
+ tls >= 2.4.13 && < 2.7
if impl(ghc >=8)
default-extensions: Strict StrictData