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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sanitizer #33

Merged
merged 3 commits into from
Jun 19, 2024
Merged

Feature/sanitizer #33

merged 3 commits into from
Jun 19, 2024

Conversation

JRocabruna
Copy link
Member

Description

This pull request introduces custom sanitizers for text and HTML content within the EmailMessage struct. Users can now specify their own sanitization logic or utilize the default sanitizers provided. This enhancement improves flexibility and security in email content handling. The changes also include comprehensive tests to ensure robust functionality and edge case coverage.

Checklist

  • The code follows the style guidelines of this project.
  • A self-review has been performed on the code.
  • The code is well-documented, and comments have been added where necessary.
  • Tests have been added to prove that the fix is effective or that the feature works. All existing tests pass.
  • Commit messages follow the convention type(scope): description.
  • The pull request has no conflicts with the base branch.
  • Any dependent changes have been merged and published in downstream modules.

Additional Information

This update includes:

  • Custom sanitizer methods: SetCustomTextSanitizer and SetCustomHtmlSanitizer.
  • Enhanced tests covering new functionalities and edge cases.
  • Updated documentation to reflect the new sanitization capabilities.

- Added DefaultTextSanitizer to use a singleton pattern, ensuring only one instance is created and reused.
- Added singleton pattern for DefaultHtmlSanitizer using bluemonday for robust HTML sanitization.
- Added singleton pattern for NonSanitator, which returns input text unchanged.
- Updated tests to cover new singleton implementations, ensuring thorough test coverage and security.

This update ensures efficient memory management and prevents tampering with the default sanitators, enhancing security and performance.
…comprehensive tests

- Added  and  methods to  to allow for custom sanitization of email content.
- Enhanced documentation for all sanitizers and updated EmailMessage methods to include warnings about custom sanitizers.
- Implemented checks for custom sanitizers in , , and  methods.
- Updated  and  to use default text sanitizer if custom sanitizer is not set.
- Added and enhanced tests to cover new functionalities and edge cases

This commit enhances the security and flexibility of the  struct by allowing custom sanitization strategies while maintaining comprehensive test coverage.
@JRocabruna JRocabruna added enhancement New feature or request refactoring Code refactoring to improve structure without changing functionality. go Pull requests that update Go code labels Jun 19, 2024
@JRocabruna JRocabruna self-assigned this Jun 19, 2024
Copy link
Collaborator

@DarkRockMountain-admin DarkRockMountain-admin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments

The changes introduced in this pull request enhance the EmailMessage struct by adding custom sanitizers for text and HTML content, improving flexibility and security. The updates are well-documented and include comprehensive tests to ensure robustness.

Review Checklist

  • Code adheres to the project's coding guidelines.
  • Changes are well-documented.
  • Tests have been added/updated and pass successfully.
  • Commit messages follow the correct format: type(scope): description.
  • No conflicts with the base branch.

Approval

Approved: Changes look good and meet the project's contribution standards.

@DarkRockMountain-admin DarkRockMountain-admin merged commit 1a4493a into develop Jun 19, 2024
8 checks passed
@DarkRockMountain-admin DarkRockMountain-admin deleted the feature/sanitizer branch June 19, 2024 15:08
@JRocabruna JRocabruna linked an issue Jun 19, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code refactoring Code refactoring to improve structure without changing functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] - Add Custom Sanitizer Interface for EmailMessage
2 participants