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

feat(email_message): encapsulate EmailMessage and Attachment struct with private fields and add constructors #16

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

JRocabruna
Copy link
Member

@JRocabruna JRocabruna commented Jun 6, 2024

Encapsulate EmailMessage and Attachment struct with private fields and add constructors

Fixed vulnerability GO-2024-2887 from package net/[email protected]

Description

This pull request encapsulates the EmailMessage and Attachment structs by making their variables private. It adds getters and setters for these variables and implements custom MarshalJSON and UnmarshalJSON methods. Additionally, constructors for creating Attachment from a filename and content, as well as from a file path, have been added. A testdata folder is created for adding test files.

This pull request also updates the Go version to 1.22.4 to address the GO-2024-2887 vulnerability found in the net/netip package.

Checklist

Please ensure the following guidelines are met:

  • 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

  • Encapsulated the EmailMessage struct by making variables private.
  • Added getters and setters for EmailMessage variables.
  • Implemented custom MarshalJSON and UnmarshalJSON methods for EmailMessage.
  • Encapsulated the Attachment struct by making variables private.
  • Added getters and setters for variables.
  • Implemented custom MarshalJSON and UnmarshalJSON methods for Attachment.
  • Added a constructor for creating Attachment from filename and content.
  • Added a constructor for creating Attachment from a file path.
  • Created a testdata folder for adding test files.
  • Updated Go version to 1.22.4 to address the GO-2024-2887 vulnerability in the net/netip package.

…ith private fields and add constructors

- Encapsulated the EmailMessage struct by making variables private
- Added getters and setters for EmailMessage variables
- Implemented custom MarshalJSON and UnmarshalJSON methods for EmailMessage
- Encapsulated the Attachment struct by making variables private
- Added getters and setters for variables
- Implemented custom MarshalJSON and UnmarshalJSON methods for Attachment
- Added a constructor for creating Attachment from filename and content
- Added a constructor for creating Attachment from a file path
- Create a testdata folder for adding test files
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

Great job encapsulating the structs and addressing the vulnerability. The constructors and updated JSON methods enhance the module's usability.

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 ea2dc99 into develop Jun 7, 2024
8 checks passed
@DarkRockMountain-admin DarkRockMountain-admin deleted the bugfix/update-go-1.22.4 branch June 7, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request refactoring Code refactoring to improve structure without changing functionality. security Issues related to improving security. test Issues related to testing, including unit tests, integration tests, and test coverage improvements.
Projects
None yet
2 participants