Univention Bugzilla – Bug 55413
Validate e-mail addresses more strictly
Last modified: 2022-11-16 18:04:03 CET
The email validation is currently: if not text.startswith('@') and \ '@' in text and \ not text.endswith('@') and \ ' ' not in text: return text This does not fail for obviously wrong mail adresses like user@@domain.de It would be nice to have a better validation in the emailAddress syntax
Correct email address validation is hard. Having a stricter address may lead to false positives. Therefore, we should make it optional so that customers can opt-out of the new rules. https://packages.debian.org/buster-backports/python3-email-validator seems to work nicely and has a debian package.
Works only if UDM is run with python3 (because there is no python-email-validator package). But I guess this is not a huge deal. If you find the new checks annoying, you can ucr set directory/manager/mail-address/extra-validation=false Fixed in univention-directory-manager-modules (15.0.13-16) 0a9c656b948d | Bug #55413: Syntax emailAddress will now be checked against external library python3-email-validator; can be disabled by directory/manager/mail-address/extra-validation univention-directory-manager-modules.yaml 52d9cdfdd621 | Bug #55413: YAML python-email-validator.yaml 630e04d21733 | Bug #55413: python-email-validator
See my comments at https://git.knut.univention.de/univention/ucs/-/commit/0a9c656b948d80484ef61af6a9c9c8fe12570e25 and make a Merge Request next time!
Added suggestions, a few fixes for different syntax classes and doctests: univention-directory-manager-modules.yaml 2b8eafc9dc20 | Bug #55413: YAML 65893b698f8e | Bug #55413: YAML 52d9cdfdd621 | Bug #55413: YAML univention-directory-manager-modules (15.0.13-22) 57a351a9fdb0 | Bug #55413: Add build dependency for doctest (2) 291caad61895 | Bug #55413: Add build dependency for doctest b411b0ba3970 | Bug #55413: Default UCR value for doctests 2daa424b7f37 | Bug #55413: Fix emailAddressTemplate; add doctests univention-directory-manager-modules (15.0.13-19) 249481cb05e2 | Bug #55413: Less strict mail validation univention-directory-manager-modules (15.0.13-18) 89a2467f56d9 | Bug #55413: Top-level imports univention-directory-manager-modules (15.0.13-17) f458e068484e | Bug #55413: Fixes for dns/forward_zone univention-directory-manager-modules (15.0.13-16) 0a9c656b948d | Bug #55413: Syntax emailAddress will now be checked against external library python3-email-validator; can be disabled by directory/manager/mail-address/extra-validation python-email-validator.yaml 249481cb05e2 | Bug #55413: Less strict mail validation 630e04d21733 | Bug #55413: python-email-validator
OK: only Python 3 support OK: usertemplates still work: > udm settings/usertemplate create --set name=template1 --set mailPrimaryAddress="A@A@<username>@example.com" OK: users/user: > udm users/user create --set username=user1 --position=cn=users,l=school,l=dev --set lastname=lastname --set password=univention --set mailPrimaryAddress="A@A@@example.com" > udm users/user create --set username=user1 --position=cn=users,l=school,l=dev --set lastname=lastname --set password=univention --set e-mail="A@A@@example.com" OK: groups/group: > udm groups/group create --set name=group1 --set mailAddress="A@A@@example.com" OK: mail/* > udm mail/folder create --set name=mail1 --set mailPrimaryAddress="A@A@@example.com" OK: dns/forward_zone: > udm dns/forward_zone modify --dn "zoneName=$(hostname -d),cn=dns,$(ucr get ldap/base)" --set contact="A@A@@example.com" > udm dns/forward_zone modify --dn "zoneName=$(hostname -d),cn=dns,$(ucr get ldap/base)" --set contact="A@example.com." OK: YAML
<https://errata.software-univention.de/#/?erratum=5.0x489> <https://errata.software-univention.de/#/?erratum=5.0x491>