[Bug] adminOnly middleware ignores tokens from .auth-tokens.json #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug Description
The
adminOnlymiddleware insrc/middleware/auth.jsonly checks ifreq.isAdminis true, butreq.isAdminis only set whentoken === config.adminToken. Tokens stored in.auth-tokens.jsonare never marked as admin.Impact
Users who generate tokens via
POST /auth/tokencannot generate further tokens because they are never treated as admins.Current Code (auth.js)
Suggested Fix
Add an
isAdminflag to tokens stored in.auth-tokens.json, or track the original admin token used to generate them.