Comments (3)
Hey Martin! Thanks for bringing this up. I was aware of this issue when I built support for custom HTML. I decided to offload the responsibility to sanitize the content to the developer. I don't want Notyf to be too smart, to be honest. I'd rather have it be a dumb component even if it comes at the cost of such liability.
Your point is valid, though. I'll add a warning in the docs to make sure devs don't miss this (hopefully their frameworks will also help in this).
Thanks!
from notyf.
@caroso1222 I appreciate the work you put into developing and designing Notyf. That said, I hope you can reconsider @mgrubinger's proposal of essentially changing line 174 from message.innerHTML = ...
to message.textContent = ...
.
As an open-source developer it's okay to de-scope features and responsibilities- but in this case it would make sense to apply the straightforward fix. Offloading the responsibility of sanitising to the developer is a poor methodology in general as the modern sanitisation approach is to leverage element.textContent
anyway.
from notyf.
Hey @jagracey. Thanks for your input! I understand the concern. In my view, there are two things to consider here.
First, textContent
is by no means an alternative to innerHTML
. It's a very different feature. Changing that line would result in breaking changes as you'd no longer be able to render notifications like 'You scored <b>500 pts </b>!'
which was a feature requested by the community (#17, #22). Supporting custom HTML is one of the upsides of Notyf these days.
Second, HTML sanitization is too complex for this plugin to handle. I wouldn't like to have my project running with several libraries, all of them having 200 LOC of HTML sanitation.
Once again, I appreciate the intention. I understand an injection attack is serious and that's why I put the warning in the readme. However, Introducing a breaking change or writing several LOC to sanitize is not in the scope of the project.
from notyf.
Related Issues (20)
- [ Feature Request ] Pause on hover HOT 2
- [ Feature Request ] Use vscode remote containers
- Allow custom css to be injected HOT 1
- Using long text
- Link to the documentation flag as insecure HOT 1
- [Feature Request] Config option for a custom node to attach toast notifications HOT 2
- How to make a notification appear only once HOT 2
- Website SSL certificate expired HOT 2
- I don't know how to properly set the position value on vue? HOT 1
- Will this work inside of a shadow DOM? HOT 1
- How to make the notification called only once. And he didn't write it into the document every time he called.
- Is there a way to set position per call ? HOT 1
- esc key
- I want to change the z-index.
- Different position moves existing notifications
- All of my styling dosent work (vuejs(composition api) ,tailwindcss)
- Icons don't display on warn, info type
- Long text creates curve?
- Uncaught (in promise) TypeError: notyf is undefined HOT 1
- Pause timer when the window loses focus
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from notyf.