🚀 Feature: Protection against disabling / deleting only admin account #102

Closed
opened 2025-10-07 00:01:46 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @filleokus on GitHub.

Feature description

When logged in as an admin in the admin dashboard it would be nice if the application protected me from myself, by not allowing me to disable or delete the only admin account.

Pitch

I was disabling some users in my instance and didn't look too carefully and accidentally disabled my own account, locking myself out of PocketID since I only had one admin account 😅 Looking at the source I believe it's also possible to delete the account in the same fashion.

I don't know how big of an issue this is, but it probably doesn't make sense to disable or deactivate the only admin account (or maybe even not the currently logged in admin account?).


If anyone else stumbles upon this issue, it was easy to re-enable the account: I'm running pocket-id in kubernetes with a persistent volume, so I created a pod and just mounted in the pvc, and then used the sqlite cli to manually flip the flag in the database.

sqlite-debug-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: sqlite-debug
  namespace: pocket-id
spec:
  restartPolicy: Never
  containers:
  - name: sqlite
    image: nouchka/sqlite3
    command: ["sleep","3600"]
    volumeMounts:
    - name: app-data
      mountPath: /data
  volumes:
  - name: app-data
    persistentVolumeClaim:
      claimName: data-pocket-id-0
➜ ~ kubectl apply -f sqlite-debug-pod.yaml
➜ ~ kubectl exec -it sqlite-debug -n pocket-id -- bash
root@sqlite-debug:/# sqlite3 /data/pocket-id.db

BEGIN TRANSACTION;
UPDATE users
SET disabled = 0
WHERE email = 'filleokus@example.com';
COMMIT;
Originally created by @filleokus on GitHub. ### Feature description When logged in as an admin in the admin dashboard it would be nice if the application protected me from myself, by not allowing me to disable or delete the only admin account. ### Pitch I was disabling some users in my instance and didn't look too carefully and accidentally disabled my own account, locking myself out of PocketID since I only had one admin account 😅 Looking at the source I believe it's also possible to delete the account in the same fashion. I don't know how big of an issue this is, but it probably doesn't make sense to disable or deactivate the only admin account (or maybe even not the currently logged in admin account?). ---- If anyone else stumbles upon this issue, it was easy to re-enable the account: I'm running pocket-id in kubernetes with a persistent volume, so I created a pod and just mounted in the pvc, and then used the sqlite cli to manually flip the flag in the database. <details> <summary>sqlite-debug-pod.yaml</summary> ```yaml apiVersion: v1 kind: Pod metadata: name: sqlite-debug namespace: pocket-id spec: restartPolicy: Never containers: - name: sqlite image: nouchka/sqlite3 command: ["sleep","3600"] volumeMounts: - name: app-data mountPath: /data volumes: - name: app-data persistentVolumeClaim: claimName: data-pocket-id-0 ``` </details> ``` ➜ ~ kubectl apply -f sqlite-debug-pod.yaml ➜ ~ kubectl exec -it sqlite-debug -n pocket-id -- bash root@sqlite-debug:/# sqlite3 /data/pocket-id.db BEGIN TRANSACTION; UPDATE users SET disabled = 0 WHERE email = 'filleokus@example.com'; COMMIT; ```
OVERLORD added the needs more upvotes label 2025-10-07 00:01:46 +03:00
Author
Owner

@filleokus commented on GitHub:

Thanks! From my perspective that's enough to solve my issue 👍

@filleokus commented on GitHub: Thanks! From my perspective that's enough to solve my issue 👍
Author
Owner

@kmendell commented on GitHub:

As of this commit: f0c144c51c, You wont be able to Disable/Delete the admin account you are signed in with.

Does this suffice your needs? or do you think a better alterntiave should be used instead?

@kmendell commented on GitHub: As of this commit: https://github.com/pocket-id/pocket-id/commit/f0c144c51c635bc348222a00d3bc88bc4e0711ef, You wont be able to Disable/Delete the admin account you are signed in with. Does this suffice your needs? or do you think a better alterntiave should be used instead?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#102