Skip to content

BUG: User in legal group and with staff status is effectively a superuser #266

Closed

Description

@rogu-beta

Describe the bug
Users that are assigned to the "Legal" group and have Staff Status enable, currently posses the following permissions among others, as documented by the permission matrix:

  • Change dataspace
  • Add users
  • Change users

This appears to have unintended or at least unexpected consequences from the perspective of DejaCode users. Users with the permissions as described above can perform the following actions:

  • Increase their privilege by making themselves a superuser
  • Remove permissions from higher privileged accounts such as superusers
  • Deactivating higher privileged users such as superusers

As such assigning a user to the "Legal" group and giving them Staff Status is effectively the equivalent of making them a superuser.

To Reproduce

  1. Create a user
  2. Assign them to the "Legal" group
  3. Enable Staff Status
  4. Log in as the user you have created
  5. Check that you can escalate your own privileges and edit superusers

Expected behavior

  • Users should not be able to give themselves higher permissions
  • Users should not be able to edit user accounts that have higher permissions than themselves
  • It is questionable that the "Legal" group needs to manage the dataspace and users at all, as this is an administrative task

Screenshots
n.a.

Context (OS, Browser, Device, etc.):
n.a.

Activity

  1. added
    bugSomething isn't working
    design neededDesign details needed to complete the issue
    enhancementNew feature or request
    on Feb 19, 2025
  2. changed the title [-]BUG:[/-] [+]BUG: User in legal group and with staff status is effectively a superuser[/+] on Feb 19, 2025
  3. tdruez commented on Oct 9, 2026

    @tdruez
    Contributor

    Hey @rogu-beta, as usual, thanks for the report!

    This is now fixed in two places:

    1. Code changes (#595)

    The user admin now prevents privilege escalation by non-superusers:

    • Only superusers can view, change, or disable users.
    • Non-superusers with the "add user" permission can still create users, with two limits:
      • they cannot set the superuser status;
      • they can only assign groups they belong to.

    2. "Legal" group permissions

    The "Legal" group in the initial data no longer has these 3 permissions:

    • add_dejacodeuser
    • change_dejacodeuser
    • change_dataspace

    New installations will get the updated group in the next release. On an existing installation, remove these 3 permissions from the "Legal" group in the admin: Groups > Legal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdesign neededDesign details needed to complete the issueenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions