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

sanitize should use a whitelist, not a blacklist #3

Open
feross opened this issue Sep 20, 2013 · 1 comment
Open

sanitize should use a whitelist, not a blacklist #3

feross opened this issue Sep 20, 2013 · 1 comment

Comments

@feross
Copy link

feross commented Sep 20, 2013

It's a lot easier, safer, and future-proof to specify just the tags that you want to allow, instead of everything to disallow.

For example, 'onclick', 'onerror', 'onhover', 'onmouseover'... are there other attributes I'm missing? Does Gecko/Webkit/Blink have other proprietary events I need to blacklist to protect users of those browsers?

@feross
Copy link
Author

feross commented Sep 20, 2013

Realized that I can pass a function to sanitize and do return !whitelist(name). Still, would be better to encourage people to use a whitelist.

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

No branches or pull requests

1 participant