Bug 56419 - ucs-school-testuser-import creates email addresses the importer rejects
ucs-school-testuser-import creates email addresses the importer rejects
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 5.0
Other Linux
: P5 minor (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-08-11 09:33 CEST by Moritz Bunkus
Modified: 2023-08-14 14:41 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?: Yes
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Bunkus 2023-08-11 09:33:28 CEST
A couple of names in the test data file /usr/share/doc/ucs-school-import/test_data.json.gz end with a full stop (e.g. given name "Nanetta." or family name "Pove..."). If one such a name is chosen, the email address the importer auto-generates contains more than one consecutive full stop (e.g. "nanetta..farck@<fqdn>" or "ioanna.peru...@<fqdn>").

Such addresses are rejected by the importer with the following error message:

2023-08-09 15:20:01 ERROR user_import.create_and_modify_users:278  Entry #0: ValidationError when adding ImportStudent(name='nanetta..farck', school='Perf31', dn='uid=nanetta..farck,cn=schueler,cn=users,ou=Perf31,dc=ucs,dc=test,dc=myschool,dc=bildungslogin,dc=de', old_dn=None) (source_uid:Perf31 record_uid: Nanetta..Farck): {'email': ['Not a valid email address! The email address contains invalid characters before the @-sign: FULL STOP.']} ValidationError({'email': ['Not a valid email address! The email address contains invalid characters before the @-sign: FULL STOP.']})

The same error message happens if the family name's the one ending with a full stop, too.

I would argue that there are two issues here:

1. The test data shouldn't contain names that end with a full stop as those names don't usually exist.
2. The importer rejecting email addresses that aren't really invalid, especially with an error message that's just plain wrong: there's no full stop directly before the @

Either way, the importer aborts.

How to reproduce:

1. Reduce the test_data.json.gz to one given & one family name, with the given name endingn in a full stop. For example:

{
  "given": [
    "Nanetta."
  ],
  "family": [
    "Farck"
  ]
}

2. Adjust the import config to use a schema that auto-generates an email address from the login name, e.g.

"email": "<username>@<maildomain>",

3. Create demo users:

/usr/share/ucs-school-import/scripts/ucs-school-testuser-import --staff 0 --students 1 --teachers 0 --staffteachers 0 --classes 1 --inclasses 1 --schools 0 <School ID>


Version info:

[0 root@dc-primary.ucs.test.myschool.bildungslogin.de ~] ucr search --brief '^version/'
version/erratalevel: 772
version/patchlevel: 3
version/releasename: Blumenthal
version/version: 5.0
[0 root@dc-primary.ucs.test.myschool.bildungslogin.de ~] univention-app info
UCS: 5.0-3 errata772
Installed: self-service=5.0 self-service-backend=5.0 ucsschool=5.0 v3 4.4/openid-connect-provider=2.2-konnect-0.33.11-2 4.4/ucsschool-apis=1.0.6 4.4/ucsschool-kelvin-rest-api=1.8.9 4.4/ucsschool-veyon-proxy=4.7.4.14-0
Upgradable: ucsschool
Comment 1 Jan-Luca Kiok univentionstaff 2023-08-11 18:02:04 CEST
Thanks for the report, I agree with both points mentioned. My remarks:

> 2. The importer rejecting email addresses that aren't really invalid, especially with an error message that's just plain wrong: there's no full stop directly before the @

That sounds similar to https://forge.univention.org/bugzilla/show_bug.cgi?id=53933, it might make sense to look into both together or at least come to a uniform solution.

> 1. The test data shouldn't contain names that end with a full stop as those names don't usually exist.

I guess this is something we can tackle beforehand too, the balance will be to come to a test set that includes edge cases that indeed concern the import on one hand and not including things like this on the other hand.
Have you found other subpar test data sets or was the full stop the only thing you encountered?
Comment 2 Moritz Bunkus 2023-08-14 10:39:31 CEST
Thanks for the feedback.

> Have you found other subpar test data sets or was the full stop the only thing you encountered?

We've used the generator to import 100 schools with 1.000 students each. This particular issue was the only one that caused the import to fail. I opted to remove the . from the names in the test data set in order to have the import run unattended (which takes quite a while for these many entries), and afterwards everything ran fine.

In other words: this was the only issue I encountered.