Conversation
alecslupu
left a comment
There was a problem hiding this comment.
@Stef-Rousset head's up!
|
|
||
| categories_values = sorted_main_categories.flat_map do |category| | ||
| sorted_descendant_categories = category.descendants.includes(:subcategories).sort_by do |subcategory| | ||
| [subcategory.weight, translated_attribute(subcategory.name)] |
There was a problem hiding this comment.
Why not use here a "decidim_sanitize_translated", to avoid XSS ?
| [subcategory.weight, translated_attribute(subcategory.name)] | |
| [subcategory.weight, decidim_sanitize_translated(subcategory.name)] |
| end | ||
|
|
||
| subcategories = sorted_descendant_categories.flat_map do |subcategory| | ||
| Decidim::CheckBoxesTreeHelper::TreePoint.new(subcategory.id.to_s, translated_attribute(subcategory.name)) |
There was a problem hiding this comment.
Why not a ?
| Decidim::CheckBoxesTreeHelper::TreePoint.new(subcategory.id.to_s, translated_attribute(subcategory.name)) | |
| Decidim::CheckBoxesTreeHelper::TreePoint.new(subcategory.id.to_s, decidim_sanitize_translated(subcategory.name)) |
| end | ||
|
|
||
| Decidim::CheckBoxesTreeHelper::TreeNode.new( | ||
| Decidim::CheckBoxesTreeHelper::TreePoint.new(category.id.to_s, translated_attribute(category.name)), |
There was a problem hiding this comment.
| Decidim::CheckBoxesTreeHelper::TreePoint.new(category.id.to_s, translated_attribute(category.name)), | |
| Decidim::CheckBoxesTreeHelper::TreePoint.new(category.id.to_s, decidim_sanitize_translated(category.name)), |
|
Hello @alecslupu , thanks for your review ! I totally understand your concern about the security. I have a little question about this case, and I will appreciate your expertise on it. I tested (in the decidim-app) the categories without escape in front, and the Also, the scopes, which are as categories created in the BO, are not sanitized in the BO nor in the FO, and the script I would really appreciate your analysis on this topic, thanks and have a nice day ! |


🎩 Description
This PR removes escaping from categorie's names in FO.
Testing
As an admin, go to a process > Categories and update the name of a category, adding special characters (like '&"<>).
As a user, go to the proposals of the process and see that the category's name you have updated is displayed with its special characters not escaped.
📌 Related Issues
Link your PR to an issue
Tasks
📷 Screenshots
BO

FO
