Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task] Added html sanitizer to translations #15038

Merged
merged 7 commits into from
Apr 26, 2023

Conversation

Corepex
Copy link
Collaborator

@Corepex Corepex commented Apr 25, 2023

Additional info

WHAT

馃 Generated by Copilot at 1cfbd58

This pull request introduces a new service pimcore.translation_sanitizer that sanitizes translation messages and prevents invalid HTML characters. It also makes the service public, adds a configuration option, and uses it in the Translation class and the Translation/Dao.php file. This improves the security and consistency of the translation system in Pimcore.

馃 Generated by Copilot at 1cfbd58

Sanitize the words of doom
pimcore.translation_sanitizer is your tool
Cleanse the HTML from the translation gloom
Don't let the evil characters rule

HOW

馃 Generated by Copilot at 1cfbd58

  • Add a new configuration option for the HTML sanitizer service (link)
  • Make the HTML sanitizer service public and accessible from other classes (link, link, link)
  • Define a constant for the HTML sanitizer service ID in the Text utility class (link)
  • Add a property and a method to the Translation model class to lazily initialize and return the HTML sanitizer service instance (link, link)
  • Use the HTML sanitizer service to sanitize the translation text before saving it to the database in the Dao class (link, link)

@Corepex Corepex added the Task label Apr 25, 2023
@Corepex Corepex added this to the 11.0.0 milestone Apr 25, 2023
@Corepex Corepex self-assigned this Apr 25, 2023
@github-actions
Copy link

github-actions bot commented Apr 25, 2023

Review Checklist

  • Target branch (10.5 for bug fixes, others 11.x)
  • Bug fix: check if files are affected that were moved to a bundle - create a PR there if applicable
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

models/Translation.php Outdated Show resolved Hide resolved
@robertSt7 robertSt7 self-assigned this Apr 26, 2023
@robertSt7 robertSt7 merged commit 47a06a2 into 11.x Apr 26, 2023
14 checks passed
@robertSt7 robertSt7 deleted the add_sanitizer_to_translations branch April 26, 2023 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants