-
Notifications
You must be signed in to change notification settings - Fork 448
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
Replace HTMLPurifier with a maintained dependency #7916
Comments
There are few alternative packages/libraries to choose from as HTMLPurifier is still the most common and widely used one even if it's not maintained properly and there has been no major upgrade of it . Most the of popular ones are also kind of based on that one which make those more like a wrapper over it . Few available options are (based on initial R&D)
@asmecher @NateWr few stuff we need to figure out first
personally I would like to go with option 2 or 3 if we target for a long term supported package but if we just need to make it HTML5 compatible , option 1 may work for now . However , as option 1 is based on old HTMLPurifier , it may not be maintained properly and security issue may arise . Need more research . |
Thanks, @touhidurabir! To summarize our convo today:
Decisions
|
@asmecher if this is not a higher priority right now , we can get back to this one later when we caught up with PHP 8.1+ . Another option is to use a forked version of symfony/html-sanitizer that we make compatible with PHP 8.0+ but even so this package by the Now there is no such info about how the future version will integrate newer version of PHP . So we are not sure if this package will have an aggressive PHP version upgrade policy but we can always use a lower release version. For example, if we look at https://symfony.com/releases/6.0 which support 8.0+ but the https://symfony.com/releases/6.1 will require 8.1+ which seems pretty aggressive . Some more general details can be found at https://symfony.com/doc/current/contributing/community/releases.html . Also current few more details at https://symfony.com/blog/new-in-symfony-6-1-htmlsanitizer-component |
@asmecher can you check the PR at here (still need to pass the tests) . using symfony/html-sanitizer , we have few cases to consider
I find the |
* #7916 Added core PKPHtmlSanitizer class * #7916 fixed empty string issue for DOMDocument::loadHTML * #7916 removed dom node traversing and implememted W3C conigurations * #7916 updated implementation with necessary doc blocks and sanitizer property cache * #7916 patch update after rebase * #7916 removed html_entity_decode and removed config passing to core sanitization class * #7916 removed sanitizer config setter and getter
With the latest implementation, all previous issue should be resolved . Closing this now but will reopen if any issue arise again . |
@asmecher I think we need to return back the HTML Purifier as I have found an issue with symfony html sanitizer . Please take a look at the issue [Html Sanitizer] Sanitization remove single < (less than) char which is not part of any tag . symfony html sanitizer is production grade package that ships as part of symfony bundler but I think this one does not suit all our cases . Or may be it need a bit more time to mature and we jump the gun here . |
Re-opening for consideration -- we may need to revert to HTMLPurifier if Symfony sanitizer doesn't better meet our needs by wrap-up time for 3.5. |
@asmecher please check the reversion PRs at #7916 (comment) , see the section |
Thanks, @touhidurabir! All is merged, and I took care of the submodule updates manually. |
HTMLPurifier is not maintained anymore. Find another replacement toolset for "safe" HTML filtering.
It does not support HTML5: https://forum.pkp.sfu.ca/t/tinymce-stripping-anchor-tags-within-or-around-divs/72749/12
We currently use HTMLPurifier in the
PKPString::stripUnsafeHtml
function (lib/pkp/classes/core/PKPString.inc.php). This takes a configuration of allowed elements/attributes fromconfig.inc.php
.PRs
pkp-lib --> #9257
ojs --> pkp/ojs#4025 [TEST ONLY]
omp --> pkp/omp#1581 [TEST ONLY]
ops --> pkp/ops#696 [TEST ONLY]
jatsTemplate --> pkp/jatsTemplate#30
oaiJats --> pkp/oaiJats#36
Update
Based on following reasons we have decided to revert back the Symfony HTML Sanitizer and keep using the HTMLPurifier
Reverting Back HTMLPurifier
pkp-lib --> #10197
ojs --> pkp/ojs#4365 [TEST ONLY]
omp --> pkp/omp#1634 [TEST ONLY]
ops --> pkp/ops#729 [TEST ONLY]
jatsTemplate --> pkp/jatsTemplate#46
oaiJats --> pkp/oaiJats#46
The text was updated successfully, but these errors were encountered: