Specifying incorrect participantId in ChatSession.create() fails silently, causes onDeliveredReceipt()/onReadReceipt() listeners to be invoked when they shouldn't #137
Labels
🗒️ In Backlog
Reviewed by team, added to backlog
Steps to reproduce:
Expected result:
The read receipt is sent and the
onReadReceipt()
is not invoked.Actual result:
The read receipt is sent and the
onReadReceipt()
is invoked:Analysis:
The
participantId
specified inChatSession.create()
is not validated to ensure it's associated with the specifiedparticipantToken
. However, it's used to filter receipt messages received from the underlyingWebSocketManager
:amazon-connect-chatjs/src/core/chatSession.js
Line 216 in d85c517
amazon-connect-chatjs/src/core/chatSession.js
Lines 198 to 209 in d85c517
amazon-connect-chatjs/src/core/chatSession.js
Lines 37 to 38 in d85c517
amazon-connect-chatjs/src/core/chatSession.js
Lines 52 to 70 in d85c517
amazon-connect-chatjs/src/core/chatArgsValidator.js
Lines 88 to 100 in d85c517
amazon-connect-chatjs/src/core/chatArgsValidator.js
Lines 53 to 82 in d85c517
amazon-connect-chatjs/src/core/chatController.js
Lines 32 to 44 in d85c517
Ultimately, when a receipt message is received, it's filtered based on the
participantId
:amazon-connect-chatjs/src/core/chatController.js
Lines 254 to 265 in d85c517
amazon-connect-chatjs/src/core/MessageReceiptsUtil.js
Lines 26 to 29 in d85c517
amazon-connect-chatjs/src/core/MessageReceiptsUtil.js
Lines 54 to 60 in d85c517
Thus, this results in
onDeliveredReceipt()
/onReadReceipt()
event listeners being triggered for receipts sent by oneself because theparticipantId
does not match.Proposed fix:
Modify
ChatController.prototype.connect()
to validate that the specifiedparticipantId
is associated with the specifiedparticipantToken
and throw anError
otherwise.In order to do the validation the connectparticipant:GetTranscript operation could be used.
The text was updated successfully, but these errors were encountered: