Reject duplicate STM short link updates (#1813)

Co-authored-by: Paul Bottinelli <paul.bottinelli@trailofbits.com>
This commit is contained in:
Evgeny
2026-06-21 09:42:35 +01:00
committed by GitHub
co-authored by Paul Bottinelli
parent aca1d9a462
commit 45b21ec1db
2 changed files with 54 additions and 4 deletions
@@ -178,10 +178,13 @@ instance StoreQueueClass q => QueueStoreClass q (STMQueueStore q) where
_ -> pure $ Left AUTH
where
addLink = do
let !q' = q {queueData = Just (lnkId, d)}
writeTVar qr $ Just q'
TM.insert lnkId rId $ links st
pure $ Right ()
TM.lookup lnkId (links st) >>= \case
Just rId' | rId' /= rId -> pure $ Left AUTH
_ -> do
let !q' = q {queueData = Just (lnkId, d)}
writeTVar qr $ Just q'
TM.insert lnkId rId $ links st
pure $ Right ()
deleteQueueLinkData :: STMQueueStore q -> q -> IO (Either ErrorType ())
deleteQueueLinkData st sq =