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

Cannot easily use v-tooltip with user-generated content (XSS / HTML injection) #110

Closed
x1B opened this issue Mar 29, 2018 · 1 comment
Closed

Comments

@x1B
Copy link

x1B commented Mar 29, 2018

First, thanks for creating this very useful project.

I noticed that it is currently not easily possible to safely put user-generated content into v-tooltip, because the popper option html is always true and I cannot seem to override it. E.g. if you have code such as v-tooltip="user.name", users would be able to enter a name such as <b>Example</b> or worse, leading to XSS vulnerabilities.

I tried the following approaches, but none of them helped:

  • install VTooltip with { defaultPopperOptions: { html: false } } using Vue.use
  • pass v-tooltip="{ popperOptions: { html: false }, content: user.name }"
  • pass v-tooltip="{ html: false, content: user.name }"

I would expect at least the first two options to work.

Right now, the only way seems to be

  • either to manually sanitize the input text using e.g. the DOM API,
  • or to use v-popover instead, which is much more complicated compared to v-tooltip.

Personally, I think that the most straightforward way to use v-tooltip (just using the directive attribute) should also be "safe by default". Or is there maybe another simple way to achieve what I am looking for?

@x1B
Copy link
Author

x1B commented May 7, 2018

@Akryum thanks, I'll make sure to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants