microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.6k stars 1.55k forks source link

HTML should be sanitized in messages #604

Closed danmarshall closed 6 years ago

danmarshall commented 7 years ago

A customer reported that a message containing HTML tags was being rendered:

the following html tag should not be enabled: <a href='http://example.com'>example</a>
danmarshall commented 7 years ago
  1. Sanitize the html to remove any scripting
  2. Whitelist to only the tags that we support
  3. Add “target=_blank” to hyperlinks.
billba commented 7 years ago

Do other chat clients allow any HTML at all in their markdown?

(Here I'm ignoring the "xml" message format, which supports just a handful of whitelisted tags.)

danmarshall commented 7 years ago

@billba no, they don't.

billba commented 7 years ago

Then rather than sanitize, I vote we strip HTML out entirely. I think that's what we did before.

danmarshall commented 7 years ago

I agree personally, we are circulating the idea internally.

eanders-ms commented 7 years ago

HTML support in markdown varies widely from client to client. GitHub has pretty rich support for it. Telegram supports basic font formatting tags; Skype too.

billba commented 7 years ago

Oh okay, so what Dan said is not true. It is supported in some clients. That changes my opinion.

DAN WHY MUST YOU LIE SO

danmarshall commented 7 years ago

@reyesrico - can you create a matrix of which channels support HTML?

reyesrico commented 7 years ago
Channel Markdown Support HTML in Markdown Support
Bing Yes No
Cortana Yes No
Facebook No -
GroupMe No -
Kik No -
Slack Partial No
Telegram Yes No
Twillio (Web) No -
WeChat No -
Email Yes Yes
Microsoft Teams Partial Partial
Skype Partial Partial
Skype for Business Partial Partial
WebChat Yes No
nwhitmont commented 7 years ago

@danmarshall What's the latest?

billba commented 7 years ago

@reyesrico I'm having trouble parsing this table. I think the actual question we are asking is "For each channel that supports Markdown, does it render embedded HTML in Markdown?"

danmarshall commented 7 years ago

@billba - I see. Yes I can just re-order the columns. And then put n/a in the HTML cell if markdown isn't supported on that channel.

danmarshall commented 7 years ago

Table has been updated.

billba commented 7 years ago

Much clearer, thanks!

MathBunny commented 7 years ago

Hello, how would I render a table then inside a WebChat? Is it possible? I previously used to render tables through my bot

AmolPawarGitHub commented 7 years ago

HTML in iframe webchat does not render.I have used HTML tags like table tags to show data in bot and now the output looks like a mess. What is the solution for this?

corinagum commented 6 years ago

Fixed in v4