Skip to content

Deleting the Install administrator breaks installing a new license key #3607

Description

@journyxtravis

Describe the bug
After install, if you delete the install user, any changes to the "settings" table, such as trying to install a new license key fails with no message visible to the user making the change. Server logs emit a clear message.

To Reproduce
Steps to reproduce the behavior:

  1. After installation create a second user and assign them Administrator.
  2. Log out and log in as that second user.
  3. Delete the first user that was used for installation.
  4. Go under Settings to License and Edit your existing license.
  5. Click "Submit"

Currently the button appears to not work. If you look in your browser's network console you will see an API call to /settings fail with a 500 server error. Checking server logs reveals the error

Aug 25 12:44:50 ____ defguard[1328191]: 2026-08-25T12:44:50.564892Z ERROR http_request{method=PATCH path=/api/v1/settings}: defguard_core::handlers: message=Database error: error returned from database: insert or update on table "settings" violates foreign key constraint "fk_default_admin" [2.0.2 Ubuntu 22.4.0 aarch64]

Expected behavior
There should be a couple expected behaviors.

  1. You should not be able to delete the Install user if it is referenced by another table. Step 2 above should have thrown an error preventing me from deleting the user.
  2. Clicking "Submit" when changing the license key should show a message if there was an error.

Version information

  • Defguard Core version: v2.0.2
  • Ubuntu 22.04.5 LTS
  • Firefox 153.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions