rails / rails-html-sanitizer

MIT License
306 stars 83 forks source link

allow `time` tag and `lang` attr, remove `XPATHS_TO_REMOVE`, add test coverage, get JRuby green #156

Closed flavorjones closed 1 year ago

flavorjones commented 1 year ago

Preparing for a larger refactor related to HTML5 parsing support, this PR started as backfilling test coverage for the default safelist.

public API changes

Note that time tag and lang attribute are safe and are already allowed by Loofah, DOMPurify, and other common sanitizers.

The XPATHS_TO_REMOVE constant was public, but probably should have been a private constant (an implementation detail) all along. It's possible that removing it might break somebody who's monkeypatching the sanitizer, but really they should be using SafeListSanitizer's allowed_tags and allowed_attributes attrs instead of changing the value of this constant.

test suite changes

Within the test suite, I've also made the following changes:

flavorjones commented 1 year ago

Actions isn't working well, but I kicked off a manual run of CI on this PR at https://github.com/rails/rails-html-sanitizer/actions/runs/4948930151 which is green.