integrations / microsoft-teams

Bringing your code and work to the conversations you care about with the GitHub and Microsoft integration
430 stars 95 forks source link

Adaptive Card Invoke Action.Submit invalid payload from iOS Teams v4.16.0 #235

Closed JMVCyber closed 2 years ago

JMVCyber commented 2 years ago

Describe the bug An adaptive card with a button Action.Submit results in an invalid payload which causes the Python botframework to crash when attempting to de-serialize.

To Reproduce Steps to reproduce the behavior:

  1. Create an adapative card with an Action.Submit with the following payload:
                        {
                            "type": "Action.Submit",
                            "title": "Edit",
                            "data": {
                                "msteams": {
                                    "type": "task/fetch"
                                },
                                "action": "GetInfo",
                                "info_id": ${id}
                            }
                        }
  2. On iOS with Teams v4.16.0 click the button
  3. Observe that the payload received by the bot includes a key value pair: "tabContext": ""
  4. The python BotFramework SDK - botbuildercore v4.14.2 will then fail attempting to tread the empty string value from tabContext as a dictionary.
  5. Stacktrace: File "/usr/local/lib/python3.9/site-packages/msrest/serialization.py", line 1418, in _deserialize found_value = key_extractor(attr, attr_desc, data) File "/usr/local/lib/python3.9/site-packages/msrest/serialization.py", line 1162, in rest_key_extractor return working_data.get(key) AttributeError: 'str' object has no attribute 'get'

Expected behavior Teams on iOS should not send the empty tabContext element to have the same behaviour as desktop and Android clients.

Smartphone:

Additional context Full payload that causes de-serialization exception:

{
  "name": "task/fetch",
  "type": "invoke",
  "timestamp": "2022-09-12T16:30:42.382Z",
  "localTimestamp": "2022-09-12T18:30:42.382+02:00",
  "id": "redacted",
  "channelId": "msteams",
  "serviceUrl": "https://smba.trafficmanager.net/uk/",
  "from": {
    "id": "redacted",
    "name": "redacted",
    "aadObjectId": "redacted"
  },
  "conversation": {
    "conversationType": "personal",
    "tenantId": "redacted",
    "id": "redacted"
  },
  "recipient": {
    "id": "redacted",
    "name": "redacted"
  },
  "entities": [
    {
      "locale": "en-US",
      "country": "GB",
      "platform": "iOS",
      "timezone": "Europe/Brussels",
      "type": "clientInfo"
    }
  ],
  "channelData": {
    "tenant": {
      "id": "redacted"
    },
    "source": {
      "name": "compose"
    },
    "legacy": {
      "replyToId": "redacted"
    }
  },
  "replyToId": "redacted",
  "value": {
    "context": {
      "theme": "default"
    },
    "data": {
      "info_id": "636",
      "type": "task/fetch",
      "action": "GetInfo"
    },
    "tabContext": ""
  },
  "locale": "en-US",
  "localTimezone": "Europe/Brussels"
}
JMVCyber commented 2 years ago

Wrong repo