-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix(tools-api): pasteConfig.tags now supports a sanitize config #2100
Conversation
I think, the best soultuion is to support our sanitization config at the static get pasteConfig() {
return {
tags: [ 'img[src]' ], // <-- all attributes except 'src' will be stripped
};
} |
Thank you for addressing this issue! FWIW, I'd suggest using tools focused on XSS sanitization such as dompurify. |
@neSpecc I tried this solution but in that case, the configuration for sanitisation is as below:
|
@jorgectf We are planning to integrate the library you recommended in our next release because accordingly, we need to update every tool with the API. So, this is just a hotfix right now. |
You should not create a config manually, it should be collected from tools. For example, Image tool should change |
Yup, I have done the same things I am just doing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to cover it with unit tests
Co-authored-by: Peter Savchenko <[email protected]>
Co-authored-by: Jorge <[email protected]>
add a changelog describing fix and API change please |
The solution still does not work as expected. If a Tool does not specify the sanitizer config, all attributes should be removed. For now, it doesn't work. I'm digging into it. |
Seems ok for now. Will test it again tomorrow |
hey @neSpecc, Pls check and let me know when to merge. |
Sorry, the last test became a problem and I've spent some time on it. I've found the bug with our sanitizing dependency HTMLJanitor. It has a bug with Table sanitizing (guardian/html-janitor#3) so I've added a few lines to handle that case. Now all the tests work fine. |
depends on next version of image tool and simple-image tool