Bug 54653 - [Kelvin] make validation of ucsschool roles more robust
[Kelvin] make validation of ucsschool roles more robust
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: HTTP-API (Kelvin)
UCS@school 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: Amir Teymuri
Tobias Wenzel
https://git.knut.univention.de/univen...
:
Depends on: 54535
Blocks:
  Show dependency treegraph
 
Reported: 2022-04-08 08:13 CEST by Ole Schwiegert
Modified: 2022-06-24 08:36 CEST (History)
5 users (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?:
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 Ole Schwiegert univentionstaff 2022-04-08 08:13:50 CEST
+++ This bug was initially created as a clone of Bug #54535 +++

ucsschool-roles with a format other than role:school:context will raise errors, e.g. in the umc

Interner Server-Fehler in "schoolwizards/users/query (schoolwizards/users)".
Request: schoolwizards/users/query (schoolwizards/users)


ucsschool/lib/models/validator.py

    errors.append(cls.validate_part_of_school(roles, schools))
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/validator.py", line 228, in validate_part_of_school
    missing_schools = set([s for r, c, s in roles if c == "school" and s.lower() not in schools])
ValueError: need more than 2 values to unpack


These errors come from an incorrect of the school role, but we should log an error with a better description of whats wrong.


...
e.g. the function split_roles could be refactored into one of the validation classes, log and a) return only values as tuples (r,c,s) or b) return an empty list.


The changes have to be implemented for the Kelvin API as well!
Comment 2 Tobias Wenzel univentionstaff 2022-06-03 19:55:45 CEST
QA:

- changelog ok
- merge ok

[main] e3a1a458 Bug #54653: invalid ucsschool-roles don't crash the validation

- pipeline green 


will verify after jenkins is happy.
Comment 3 Tobias Wenzel univentionstaff 2022-06-03 21:26:13 CEST
qa: all ok

jenkins is happy

-> verify
Comment 4 Tobias Wenzel univentionstaff 2022-06-24 08:36:49 CEST
Released with 1.5.5 -> closing this issue.