Skip to content

feat: capture and log non-whitelisted email recipients in staging environment - #48

Open
hnccox-yard wants to merge 1 commit into
mainfrom
feat/catch-emails-in-staging-env
Open

feat: capture and log non-whitelisted email recipients in staging environment#48
hnccox-yard wants to merge 1 commit into
mainfrom
feat/catch-emails-in-staging-env

Conversation

@hnccox-yard

@hnccox-yard hnccox-yard commented Jul 4, 2025

Copy link
Copy Markdown

This PR makes sure that no emails from any staging environment are actually send out via WordPress, unless they are on the whitelist. This prevents accidental emails being send when using real data.

@hnccox-yard
hnccox-yard requested review from a team, Rovasch, SimonvanWijhe, dtakken, ictbeheer, mvdhoek1, rivanuff and robertbossaert and removed request for a team July 4, 2025 19:29
@github-actions

github-actions Bot commented Jul 4, 2025

Copy link
Copy Markdown

Coverage report for commit: 9759b65
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ███████████████████████ │ 90.7%
  10% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
  20% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
 100% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 2.49% | Methods: 3.33%
FilesLinesMethodsBranches
src/ACF
   ACFServiceProvider.php--100.00%
src/ACF/Controllers
   ProtectionTypeController.php--100.00%
   WhitelistGroupController.php--100.00%
src/BranchViewer
   BranchViewer.php85.00%50.00%100.00%
   BranchViewerServiceProvider.php16.67%-100.00%
src/Cleanup
   CleanupServiceProvider.php--100.00%
   EnqueuedScriptsStyles.php--100.00%
   MapMetaCap.php--100.00%
src/Cleanup/Plugins
   BaseAbstract.php--100.00%
   SearchWP.php--100.00%
   Stream.php--100.00%
src
   ConfigExpanderServiceProvider.php--100.00%
src/Disable
   DisableAdminNotices.php--100.00%
   DisableComments.php--100.00%
   DisableEmojicons.php--100.00%
   DisableFeed.php--100.00%
   DisableHeaders.php--100.00%
   DisableOEmbedEndpoint.php--100.00%
   DisablePosts.php--100.00%
   DisableRoles.php--100.00%
   DisableServiceProvider.php--100.00%
   DisableUsersEndpoint.php--100.00%
src/Licenses/Contracts
   AbstractLicense.php--100.00%
   LicenseInterface.php100.00%100.00%100.00%
src/Licenses
   LicenseManager.php--100.00%
   LicensesServiceProvider.php--100.00%
src/Licenses/Plugins
   AdvancedCustomFieldsLicense.php--100.00%
   FacetWPLicense.php--100.00%
   GravityFormsLicense.php--100.00%
   SearchWPLicense.php--100.00%
   SeoPressLicense.php--100.00%
   WpMigrateLicense.php--100.00%
src/LoginScreenCustomization
   LoginScreenCustomization.php--100.00%
   LoginScreenCustomizationServiceProvider.php--100.00%
src/Mail
   MailServiceProvider.php--100.00%
   MailWhitelistFilter.php--100.00%
src/Protection
   Protect.php11.32%14.29%100.00%
   ProtectionServiceProvider.php--100.00%
   WhitelistEntity.php--100.00%
src/Support/Helpers
   WordPressEnvironment.php--100.00%
src/Support/Traits
   PluginActive.php--100.00%
   Route.php--100.00%
src/routes
   web.php-100.00%100.00%

🤖 comment via lucassabreu/comment-coverage-clover

@hnccox-yard
hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch 9 times, most recently from b4907b0 to 4c9f2bb Compare July 5, 2025 10:31
@mvdhoek1

mvdhoek1 commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

Wat is hier de use case van en is dit relevant voor alle projecten?

@hnccox-yard
hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch from 724d75c to 5e87d6f Compare July 5, 2025 12:49

@dtakken dtakken left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Vraag: Wil je errors enkel loggen (wat je niet meteen merkt) of een exception gooien (merk je wel meteen)?

Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php Outdated
@hnccox-yard
hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch from e892690 to e917d12 Compare July 7, 2025 13:44
Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php
Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php Outdated
Comment thread src/Mail/MailServiceProvider.php Outdated

@mvdhoek1 mvdhoek1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gelieve de boel eerst opschonen, zoals de eerdere review comments ook al aangeven.

Comment thread src/Mail/MailServiceProvider.php Outdated
@hnccox-yard
hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch 3 times, most recently from 1151093 to 5fd63ea Compare November 4, 2025 09:35
@hnccox-yard

Copy link
Copy Markdown
Author

Vraag: Wil je errors enkel loggen (wat je niet meteen merkt) of een exception gooien (merk je wel meteen)?

Ik denk dat loggen voldoende is, dit is niet iets wat in Sentry hoeft te komen denk ik.

@hnccox-yard
hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch 10 times, most recently from 2346917 to abf6ec8 Compare November 4, 2025 12:25
@hnccox-yard
hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch from abf6ec8 to ad8b13f Compare November 4, 2025 12:27
/**
* Filter wp_mail to restrict email sending in staging environment.
*/
add_filter('wp_mail', [MailHandler::class, 'filter']);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worden de IDE's ook blij van: add_filter('wp_mail', MailHandler::filter(...));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants