From a379dde3743704b0e7003fcb0fc814a51699d131 Mon Sep 17 00:00:00 2001 From: Mridul Pathak Date: Tue, 15 Sep 2026 15:49:25 +0530 Subject: [PATCH] Fixed: createEmailAddress and updateEmailAddress accept blank email addresses (OFBIZ-13582) Both methods gated only on UtilValidate.isEmail(parameters.emailAddress), which returns true for a null or blank string by design. Combined with the servicedef declaring emailAddress required but with no type-validate rule, and the service engine's required-parameter check only rejecting null rather than blank, a caller passing an empty string sailed through and created or updated a real ContactMech with a blank infoString. The original minilang had two explicit checks, not-empty then format-valid, so both methods now reject a blank emailAddress before the format check runs. --- .../ofbiz/party/contact/ContactMechServicesScript.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy index 4126f25546e..c815df2e343 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy @@ -189,6 +189,9 @@ Map updateTelecomNumber() { * Create an email address contact mechanism */ Map createEmailAddress() { + if (!parameters.emailAddress) { + return error(UtilProperties.getMessage('PartyUiLabels', 'PartyEmailAddressMissing', locale)) + } if (UtilValidate.isEmail(parameters.emailAddress)) { Map createContactMechMap = [contactMechTypeId: 'EMAIL_ADDRESS', contactMechId: parameters.contactMechId, @@ -206,6 +209,9 @@ Map createEmailAddress() { * Update an email address contact mechanism */ Map updateEmailAddress() { + if (!parameters.emailAddress) { + return error(UtilProperties.getMessage('PartyUiLabels', 'PartyEmailAddressMissing', locale)) + } if (UtilValidate.isEmail(parameters.emailAddress)) { Map updateContactMechMap = [contactMechTypeId: 'EMAIL_ADDRESS', contactMechId: parameters.contactMechId,