Closed (duplicate)
Project:
Drupal core
Version:
11.x-dev
Component:
system.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Apr 2024 at 07:22 UTC
Updated:
6 Jul 2025 at 01:58 UTC
Jump to comment: Most recent
Comments
Comment #4
kunal.sachdev commentedComment #5
smustgrave commentedSeems like good validation to me.
Comment #6
alexpottCommitted and pushed 93682028b4 to 11.x and f12a516b4f to 10.3.x. Thanks!
Comment #9
wim leersI have to disagree with #5. 😅🙈
This marked
system.mailas fully validatable, but it did not change:… meaning literally any string is accepted, whereas AFAICT it must be a valid
@Mailplugin ID? See\Drupal\Core\Mail\MailManager::getInstance().Similarly,
mailer_dsn'sschemeandhostshould probably also be validated but currently aren't.The key-value pairs under
mailer_dsnare trickier/more questionable though, but the mail interfaces are a clear omission.Comment #11
alexpott@Wim Leers great points. Reverted.
Comment #13
wim leersThanks 🙏
Comment #16
kunal.sachdev commentedFor #9 I think we already have a constraint
to check if the plugin name is valid.
I also tried to validate the key-value pairs of
mailre_dsnmainlyschemeandhostbut those are more tricky. For 'scheme' I tried to add the samePluginExistsconstraint but with theplugin.manager.mailer_transportplugin manager which is fromsymfony_mailermodule.Comment #17
kunal.sachdev commentedComment #18
wim leers#16: indeed,
PluginExistsis what you want.Most importantly: you set this to but I see no new commits? 😅
Comment #20
penyaskitoDiscussed with Wim and we were looking at https://symfony.com/doc/current/reference/constraints/AtLeastOneOf.html, as hostname could be a hostname, a ipv4 or a ipv6. After some pairing we figured out that using composite constraints might be complex and could be deferred to a follow-up, as it's not very common to use a IP for a mail server hostname.
However, back at home just discovered the Symfony "Hostname" validator will consider "default" as an invalid one, and that's our default for e.g. when using sendmail, so we really need to figure this out here.
Comment #21
penyaskitoGave it a try and I think I ended up in the same place I ended up on Wim's computer.
Created https://git.drupalcode.org/issue/drupal-3440975/-/merge_requests/1/diffs for not polluting the original MR. I got stuck when in some place we are expecting typed data instead of the underlying value (or the opposite). Might be easier if we just extend from the symfony validators (as Regex does already), but definitely not as clean :-/
Comment #22
znerol commentedOops, did some work in parallel on
system.mail.mailer_dsnover in #3401255: Tighten config validation schema of system.mail mailer_dsn.Comment #23
penyaskito@WimLeers this should probably closed as duplicated, but do you think is worth opening another issue for trying to reuse the symfony validators OOTB. specially for those like AtLeastOneOf?
Comment #24
wim leersNice, #3401255: Tighten config validation schema of system.mail mailer_dsn landed while I was on vacation, so … I agree this can be closed.
I do think it would be superb to create a new issue for adopting
AtLeastOneOf! (I lost track of it after pairing with you on getting that to work at DrupalCon Portland, @penyaskito 🙈 — been too occupied with https://wimleers.com/tags/experience-builder.)Could you open that? 🙏 And perhaps share/describe what the challenges are in adopting that?
Comment #25
znerol commentedFollow-up: #3461720: Create AtLeastOneOf constraint.
Comment #26
kunal.sachdev commentedI also tried to use
AltLeastOneOfconstraint in #3441434: Add validation constraints to core.menu.schema.yml and I have mentioned the problems I faced in https://www.drupal.org/project/drupal/issues/3441434#comment-15686742.Comment #27
quietone commentedChanges are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.
Comment #28
bbralaFollowup was made, and this issue was du-plicated by: #3401255: Tighten config validation schema of system.mail mailer_dsn.
Fixed credits and closing as dupe
Comment #29
xjm