The adminOnly middleware in src/middleware/auth.js only checks if req.isAdmin is true, but req.isAdmin is only set when token === config.adminToken. Tokens stored in .auth-tokens.json are never marked as admin.
Impact
Users who generate tokens via POST /auth/token cannot generate further tokens because they are never treated as admins.
Current Code (auth.js)
req.isAdmin=token===config.adminToken;
Suggested Fix
Add an isAdmin flag to tokens stored in .auth-tokens.json, or track the original admin token used to generate them.
## Bug Description
The `adminOnly` middleware in `src/middleware/auth.js` only checks if `req.isAdmin` is true, but `req.isAdmin` is only set when `token === config.adminToken`. Tokens stored in `.auth-tokens.json` are never marked as admin.
## Impact
Users who generate tokens via `POST /auth/token` cannot generate further tokens because they are never treated as admins.
## Current Code (auth.js)
```js
req.isAdmin = token === config.adminToken;
```
## Suggested Fix
Add an `isAdmin` flag to tokens stored in `.auth-tokens.json`, or track the original admin token used to generate them.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.