Bug #67665
matomo: passer les paramètres publics des appels WS vers matomo dans la query-string
Début:
23 juillet 2022
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
Pour comparer dans les logs nginx le paramètre "email",
- reçu depuis la recette du SaaS où la configuration automatique de matomo échoue,
- avec celui reçu depuis une instance devinst où la configuration fonctionne :
POST /?method=UsersManager.addUser&userLogin=combo.dev.publik.love&email=noreply%2Bcombo.dev.publik.love%40entrouvert.org&initialIdSite=54&module=API&language=en
Fichiers
Historique
Mis à jour par Nicolas Roche il y a presque 2 ans
- Fichier 0001-matomo-call-WS-with-public-parameters-into-the-query.patch 0001-matomo-call-WS-with-public-parameters-into-the-query.patch ajouté
- Tracker changé de Support à Bug
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Mis à jour par Frédéric Péters il y a presque 2 ans
L'email reçu est noreply-portail-mesdemarchesenmairie-thononagglo.test.entrouvert.org@entrouvert.org
Ça s'obtient en modifiant l'API.php pour l'inclure dans l'erreur :
if (!Piwik::isValidEmailString($email)) { throw new Exception(Piwik::translate('UsersManager_ExceptionInvalidEmail') . "(email: $email)"); }
Après avoir redémarré hobo pour prendre en compte le /etc/hobo/settings.d/matomo.py ça revient à la valeur attendue, noreply+portail-mesdemarchesenmairie-thononagglo.test.entrouvert.org@entrouvert.org.
Le problème ici est côté PHP ou Matomo,
$ php -a Interactive mode enabled php > $email = "noreply+portail-mesdemarchesenmairie-thononagglo.test.entrouvert.org@entrouvert.org"; php > if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo("$email is a valid email address"); } php > php > $email = "noreply+portail-mesdemarchesenmairie-thononagglo@entrouvert.org"; php > if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo("$email is a valid email address"); } noreply+portail-mesdemarchesenmairie-thononagglo@entrouvert.org is a valid email address ... php > if (filter_var("1234567890123456789012345678901234567890123456789012345678901234@entrouvert.org", FILTER_VALIDATE_EMAIL)) { echo("$email is a valid email addr noreply+portail-mesdemarchesenmairie-thononagglo.test@entrouvert.org is a valid email address php > if (filter_var("12345678901234567890123456789012345678901234567890123456789012345@entrouvert.org", FILTER_VALIDATE_EMAIL)) { echo("$email is a valid email address"); } ... php > if (filter_var("1234567890123456789012345678901234567890123456789012345678901234@a.be", FILTER_VALIDATE_EMAIL)) { echo("$email is a valid email address"); } noreply+portail-mesdemarchesenmairie-thononagglo.test@entrouvert.org is a valid email address php > if (filter_var("12345678901234567890123456789012345678901234567890123456789012345@a.be", FILTER_VALIDATE_EMAIL)) { echo("$email is a validemail address"); }
Il y a dans la validation PHP une limite à 64 caractères pour la partie locale de l'adresse.
Ça correspond à la RFC, https://datatracker.ietf.org/doc/html/rfc5321#section-4.5.3.1.1
4.5.3.1.1. Local-part
The maximum total length of a user name or other local-part is 64 octets.