BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

createDirectLineSpeechAdapter 'userID' prop overwrites internal value, should be inaccessible

Open stevkan opened this issue 4 years ago • 5 comments

Screenshots

'userID' not passed in as property image

'userID' passed in as property

const adapters = await window.WebChat.createDirectLineSpeechAdapters( {
  fetchCredentials,
  userID: 'dl_abc123'
} );

image

Version

CDN v4.10.1

Describe the bug

createAdapter.js exports the create() function which includes the userID property. This property is used internally by the adapter where it is assigned a value from DL Speech which fills the recipient.from.id activity property. It is not intended to be an accessible property when implementing the createDirectLineSpeechAdapters() method. In support of this, a console message is displayed in the browser indicating userID (and username) are not supported.

If the property is passed into createDirectLineSpeechAdapters(), which utilizes the create() function, the passed in property value overwrites the value internally assigned by DL Speech.

Steps to reproduce

  1. Open Web Chat using DL Speech
  2. Pass userID into the createDirectLineSpeechAdapters()
  3. By logging the activity, observe the recipient.from.id value has been overwritten

Expected behavior

recipient.from.id property in activity should maintain value assigned by DL Speech.

[Bug]

stevkan avatar Oct 15 '20 00:10 stevkan

@compulim, I started creating a PR that would address this issue by clearing any value passed into the userID property before being read by the adapter. However, after speaking with Pooja on the Services team, regarding IcM #205385137, she indicated that she had spoken with you on this subject. She suggested from that conversation that accessing the userID is OK and the bug is related to the console logged message stating it and username are not supported.

Can you clarify whether the property or the message is the bug? I can submit a PR correcting either, once I know.

stevkan avatar Oct 15 '20 20:10 stevkan

Searching codebase of Web Chat, I can't see any of our code are trying to overwrite recipient.from.id.

Do you think it's a service-side issue?

tl;dr can you look at the HTTP/WS traffic to see if it is expected or not?

compulim avatar Oct 26 '20 20:10 compulim

@corinagum my investigations:

I modified 03.a/index.html with userID: 'dl_abcde'.

image

Then I talk to MockBot with dump-activity command, I am seeing activity.from.id is dl_abcde:

image

However, I am seeing this warning:

image

compulim avatar Mar 10 '21 22:03 compulim

note to dev: warning screencap - userId not supported should be removed

@stevkan when you say recipient.from.id property in activity should maintain value assigned by DL Speech., do you mean activity.from.id or activity.recipient.id?

corinagum avatar Mar 10 '21 22:03 corinagum

@stevkan ping

corinagum avatar Apr 26 '21 19:04 corinagum