A platform for community discussion. Free, open, simple.
FIX: Don't change the default allowed_attribute when calling #sanitize_field (#19770)
Roman Rizzi7b5f7b4484db
diff --git a/app/models/concerns/has_sanitizable_fields.rb b/app/models/concerns/has_sanitizable_fields.rbindex b0db07de00e..426c4207479 100644--- a/app/models/concerns/has_sanitizable_fields.rb+++ b/app/models/concerns/has_sanitizable_fields.rb@@ -6,7 +6,7 @@ module HasSanitizableFieldsdef sanitize_field(field, additional_attributes: [])if fieldsanitizer = Rails::Html::SafeListSanitizer.new- allowed_attributes = Rails::Html::SafeListSanitizer.allowed_attributes+ allowed_attributes = Rails::Html::SafeListSanitizer.allowed_attributes.dupif additional_attributes.present?allowed_attributes = allowed_attributes.merge(additional_attributes)