Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: better admin delete protection & more info in the status endpoint #49

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

kayra1
Copy link
Contributor

@kayra1 kayra1 commented Jul 26, 2024

Description

This PR has 2 changes:

The status endpoint now returns an initialized value

Initialized means the first admin user has been created for GoCert.

The reason to report this in status is because gocert behaves differently in a subtle way when it hasn't been initialized, namely the fact that no authentication is needed to create this first account. Clients including the frontend need a stable way to query for this information, and the status endpoint is a good place to report it.

Admin delete protection

We previously blocked any Delete request to the user with the ID of 1 to prevent users from deleting the admin account. The issue with this is the fact that the user with account ID 1 may not always be the admin account.

While this assumption is true for the current GoCert, it may not remain true when different auth methods and database connectors are added in the future. This is simply more stable.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that validate the behaviour of the software
  • I validated that new and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@kayra1 kayra1 marked this pull request as ready for review July 26, 2024 08:48
@kayra1 kayra1 requested a review from a team as a code owner July 26, 2024 08:48
@kayra1 kayra1 merged commit b92c37c into main Jul 26, 2024
11 checks passed
@kayra1 kayra1 deleted the delete-protect branch July 26, 2024 13:06
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants