Bug 54497 - wrong resolving of nested groups in /var/cache/univention-portal/groups.json - portal tile visibility is too permissive
wrong resolving of nested groups in /var/cache/univention-portal/groups.json ...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Portal
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-2-errata
Assigned To: Nikola Radovanovic
Arvid Requate
:
Depends on:
Blocks: 55120
  Show dependency treegraph
 
Reported: 2022-03-02 09:21 CET by Daniel Duchon
Modified: 2022-08-22 19:07 CEST (History)
11 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.257
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support: Yes
Flags outvoted (downgraded) after PO Review:
Ticket number: 2022022221000241, 2022072121000359
Bug group (optional): Security
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Duchon univentionstaff 2022-03-02 09:21:10 CET
The group memberships are built incorrectly in the group-cache.

Example:
User A is a member of group 1, which in turn is a member of group 2.
User B is a member of group 2:


|----------Group 2-----------|
|                            |
| |--Group 1--|              |
| |           |              |
| |  User A   |    User B    |
| |           |              |
| |-----------|              |
|                            |
|----------------------------|

In the cache, however, user B is also a member of group 1, which he is not allowed to be after the correct resolution of the group memberships.
Comment 1 Erik Damrose univentionstaff 2022-03-02 10:44:43 CET
Can you explain why this bug has the user pain status "Blocking further progress on the daily work"?

From my understanding, this bug makes certain portal tiles visible to users who should not see them. The portal is not the right place to manage access to (web-)applications with tile visibility, permissions have to be configured otherwise.
Comment 2 Daniel Duchon univentionstaff 2022-03-21 15:04:20 CET
(In reply to Erik Damrose from comment #1)
> Can you explain why this bug has the user pain status "Blocking further
> progress on the daily work"?
> 
> From my understanding, this bug makes certain portal tiles visible to users
> who should not see them. The portal is not the right place to manage access
> to (web-)applications with tile visibility, permissions have to be
> configured otherwise.

you're right, my fault. I've corrected the pain status.
Comment 8 Nikola Radovanovic univentionstaff 2022-07-14 12:17:12 CEST
MR: https://git.knut.univention.de/univention/ucs/-/merge_requests/441
Comment 9 Sönke Schwardt-Krummrich univentionstaff 2022-07-21 14:58:10 CEST
This bug occurs at one of our school customers and allows simple students or teachers to modify the portal.
Comment 10 Christina Scheinig univentionstaff 2022-07-21 15:15:08 CEST
I think an other customer went in this problem. In this case it was a teacher who can see the modify button for the portal, and therefore he sees all existing tiles. He is not able to modify the tiles, because saving leads to 403.

The user is member of a group testusers, and "domain admins" group is also member of this group. So the groupcache (/var/cache/univention-portal/groups.json) shows testusers and domain admins for the user.

For the customer this is confusing and not okay, that the user can see all tiles in the edit mode.
Comment 12 Arvid Requate univentionstaff 2022-08-11 23:11:42 CEST
univention-portal now depends on univention-group-membership-cache because it uses
that cache mechanism to efficiently determine group memberships.

Package: univention-portal
Version: 4.0.7-8
User: nradovanovic
Scope: errata5.0-2

Package: univention-group-membership-cache
Version: 2.0.0-7
User: nradovanovic
Scope: errata5.0-2

commits: git log --grep "Bug #54497"

Verified:
* Code review
* Functional tests
* Package update
* Fix of inconsistent groups.json during update
* Update with extended /usr/share/univention-portal/portals.json
* Advisories


FYI: We decided against removing the ldap_uri etc kwargs from code and default json dicts, because these could be used in extended portals.json configurations. Since there was no REAMDE.md in the univenton-portal package, which documents this for fellow developers, we could not determine if this could actually be a real life use case or not, so the original authors will have to clean up the code later if they see fit.
Comment 16 Arvid Requate univentionstaff 2022-08-15 19:42:40 CEST
Verified:
* The keys of the updated groups.json are group names again
* I used https://github.com/josephburnett/jd#command-line-usage
  to diff the old and updated groups.json and it looks ok
* Package update fixes the groups.json
* Advisory: ok