Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toVDom function on programmatic components is duplicating content on html tags #2767

Closed
eagleera opened this issue Aug 18, 2020 · 6 comments
Closed
Assignees
Labels

Comments

@eagleera
Copy link

Overview of the problem

Buefy version: [0.9.1]
Vuejs version: [2.6.11]
OS/Browser: Catalina / Chrome

Description

When using an html template inside the message prop on NotificationProgrammatic, the html doesn't render well, the classes are ignored and some tags are duplicated (I think it has to do with the toVDom function

Steps to reproduce

create a notification programmatic
in the message put <div class="has-text-success">Something's</div> not good, also I'm on <b>bottom</b>
You should see the "Something's" rendered twice

Expected behavior

Instead of "Something's" being rendered twice, we should see "Something's" on a success color

Actual behavior

the "Something's" is being rendered twice
Screen Shot 2020-08-18 at 12 22 57
Screen Shot 2020-08-18 at 12 23 39

@jtommy
Copy link
Member

jtommy commented Aug 19, 2020

The main idea is to support simple message, but I'll try to fix it

@jtommy jtommy added the bug label Aug 19, 2020
@jtommy jtommy self-assigned this Aug 19, 2020
@simeq
Copy link

simeq commented Aug 19, 2020

Can this issue be related to https://codepen.io/simeq/pen/gOrwwPE (example from documentation) and this https://codepen.io/simeq/pen/yLOaaJJ?

@jtommy
Copy link
Member

jtommy commented Aug 19, 2020

@simeq wrong docs, I'll fix it

@Tofandel
Copy link
Contributor

@jtommy The toVDom function is originally not a good idea as it doesn't fix XSS at all, so many things could go wrong when you let a user display HTML (sure with a bit of validation but HTML nontheless, you could put an onload handler in there and execute JS or just display a full on body modal) don't give a false illusion of security and make two props available as suggested
'message' => All html is allowed, 'messageText' => All html is escaped

@jtommy
Copy link
Member

jtommy commented Aug 19, 2020

Probably it's not a good parse but I don't think it's xss vulnerable because I attach only tag and text content

@Tofandel
Copy link
Contributor

Tofandel commented Aug 19, 2020

I don't really have the time, but I could easily make an attack demonstration if you want, since all tags are allowed you could make use of web components declared on the page (it's quite common with vue) they are not safe to be displayed as they will execute javascript when added to a page and you could for instance create a phishing modal given the right circumstances or just make the page crash with an unanticipated js error

Removing all attributes (eg: classes, href, form attributes) also entirely defeats the point of allowing html in the message content you might as well just allow text, because in a programmatic modal for example it now becomes impossible to display a simple form or to style the displayed message

@jtommy jtommy closed this as completed in fedee2e Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants