comms/voip/smtp: 30 CWE-407 defects + 9 CLEAN; 224 sites, 101 ecosystems
This commit is contained in:
parent
4d3fcc8e73
commit
b3842ab6b8
86 changed files with 6516 additions and 5 deletions
30
defects/simplex-chat/patch/simplex-chat-0002.patch
Normal file
30
defects/simplex-chat/patch/simplex-chat-0002.patch
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
--- a/src/Simplex/Chat/Library/Commands.hs
|
||||
+++ b/src/Simplex/Chat/Library/Commands.hs
|
||||
@@ -2378,8 +2378,9 @@ processChatCommand vr nm = \case
|
||||
APIBlockMembersForAll groupId memberIds blockFlag -> withUser $ \user ->
|
||||
withGroupLock "blockForAll" groupId $ do
|
||||
Group gInfo members <- withFastStore $ \db -> getGroup db vr user groupId
|
||||
- when (selfSelected gInfo) $ throwCmdError "can't block/unblock self"
|
||||
- let (blockMems, remainingMems, maxRole, anyAdmin, anyPending) = selectMembers members
|
||||
+ let gmIdSet = S.fromList (L.toList memberIds)
|
||||
+ when (selfSelected gmIdSet gInfo) $ throwCmdError "can't block/unblock self"
|
||||
+ let (blockMems, remainingMems, maxRole, anyAdmin, anyPending) = selectMembers gmIdSet members
|
||||
when (length blockMems /= length memberIds) $ throwChatError CEGroupMemberNotFound
|
||||
when (length memberIds > 1 && anyAdmin) $ throwCmdError "can't block/unblock multiple members when admins selected"
|
||||
when anyPending $ throwCmdError "can't block/unblock members pending approval"
|
||||
@@ -2388,11 +2389,11 @@ processChatCommand vr nm = \case
|
||||
blockMembers user gInfo blockMems remainingMems
|
||||
where
|
||||
- selfSelected GroupInfo {membership} = elem (groupMemberId' membership) memberIds
|
||||
- selectMembers :: [GroupMember] -> ([GroupMember], [GroupMember], GroupMemberRole, Bool, Bool)
|
||||
- selectMembers = foldr' addMember ([], [], GRObserver, False, False)
|
||||
+ selfSelected gmIdSet GroupInfo {membership} = S.member (groupMemberId' membership) gmIdSet
|
||||
+ selectMembers :: S.Set GroupMemberId -> [GroupMember] -> ([GroupMember], [GroupMember], GroupMemberRole, Bool, Bool)
|
||||
+ selectMembers gmIdSet = foldr' addMember ([], [], GRObserver, False, False)
|
||||
where
|
||||
addMember m@GroupMember {groupMemberId, memberRole} (block, remaining, maxRole, anyAdmin, anyPending)
|
||||
- | groupMemberId `elem` memberIds =
|
||||
+ | groupMemberId `S.member` gmIdSet =
|
||||
let maxRole' = max maxRole memberRole
|
||||
anyAdmin' = anyAdmin || memberRole >= GRAdmin
|
||||
anyPending' = anyPending || memberPending m
|
||||
Loading…
Add table
Add a link
Reference in a new issue