Skip to content

Commit 77a27d5

Browse files
committed
doc: Explicitly state that modifying sanitizer allowlists is unsafe
The allowlists in rails-html-sanitizer are curated to balance security and usability. Because Rails is a sharp knife, it's possible to add to these allowlists to suit specific edge cases. However, doing so may introduce security vulnerabilities into an app, and this updates the documentation to be clear that Rails cannot protect them if they insist on allowing unsafe tags or attributes. Hopefully this change also encourages folks to open an issue if the allowlists are missing some obvious tags or attributes, so that rather than individual developers modifying the allowlists, we can improve the functionality for everyone. [skip ci]
1 parent 00cc4ff commit 77a27d5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

actionview/lib/action_view/helpers/sanitize_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ module SanitizeHelper
2424
#
2525
# Custom sanitization rules can also be provided.
2626
#
27+
# <b>Warning</b>: Adding disallowed tags or attributes to the allowlists may introduce
28+
# vulnerabilities into your application. Please rely on the default allowlists whenever
29+
# possible, because they are curated to maintain security and safety. If you think that the
30+
# default allowlists should be expanded, please {open an issue on the rails-html-sanitizer
31+
# project}[https://github.com/rails/rails-html-sanitizer/issues].
32+
#
2733
# Please note that sanitizing user-provided text does not guarantee that the
2834
# resulting markup is valid or even well-formed.
2935
#

0 commit comments

Comments
 (0)