Registering without a password returns a 500 instead of telling you what is missing
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- express, typescript
- Ambito
- api, authentication, backend
Direzione di ricerca
Inizia da apps/http-server/src/controllers/authController.ts e confronta il controllo dei campi obbligatori del gestore della registrazione con quello del gestore dell’accesso. Aggiungi test per i campi mancanti e vuoti, quindi verifica che l’esempio curl restituisca 400 indicando il campo mancante e che la registrazione valida continui a funzionare. L’issue suggerisce anche di controllare quizController e inviteController per individuare lacune simili nella validazione del corpo della richiesta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The register handler reads the body and goes straight to work:
// apps/http-server/src/controllers/authController.ts
export const userRegisterController = async (req: Request, res: Response) => {
try {
const { name, email, password } = req.body;
const isUserExisted = await prisma.user.findUnique({ where: { email } })
if (isUserExisted) return errorResponse(res, 400, "Email is already existed..")
const hashedPassword = await bcrypt.hash(password, 10); // throws when undefined
There is no presence check, so a missing field reaches bcrypt.hash(undefined, 10), which throws into the catch and returns a generic 500.
Confirmed against the live API:
POST /api/v1/auth/register {"name":"t","email":"..."} # no password
→ 500 {"success":false,"error":"Internal Server Error..."}
The sibling login handler in the same file already does it right:
if (!email || !password) return errorResponse(res, 400, "All fields are required...");
Why it matters
A 500 says "the server is broken". A 400 says "you forgot the password". Anyone integrating with the API, or debugging a form that failed to send a field, is sent looking in the wrong place entirely — and 500s are what you page on, so this also adds noise to any error monitoring.
What a fix looks like
The smallest version is the same guard login uses. Better, since zod ^4.3.6 is already a dependency: validate the shape properly and say which field is wrong, not just that something is.
Worth checking the other controllers for the same gap while you are there — quizController and inviteController have endpoints that read req.body directly too. If you find more, mention them in the PR; fixing them all in one change is fine as long as the description lists them.
Definition of done
curl -X POST .../api/v1/auth/register -H "Content-Type: application/json" -d "{\"email\":\"[email protected]\"}"
# → 400, naming the missing field
- No request with a missing or empty field can reach
bcrypt.hash - A valid registration still works exactly as before
Good first issue: a few lines, with a working example of the right pattern directly above it in the same file.
- Lingua principale
- TypeScript
- Stelle
- 21
- Fork
- 7
- Merge medio
- 3h 39m
- PR unite (30g)
- 16
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TheCodeHeist-Coder/Rexial
-
documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TheCodeHeist-Coder/Rexial#195 ·
I maintainer di solito rispondono entro 1 giorno
-
Backend first issue bug help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TheCodeHeist-Coder/Rexial#193 ·
I maintainer di solito rispondono entro 1 giorno
-
Backend first issue bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
TheCodeHeist-Coder/Rexial#192 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted UI & UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
TheCodeHeist-Coder/Rexial#190 ·
I maintainer di solito rispondono entro 1 giorno
-
Backend first issue good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
TheCodeHeist-Coder/Rexial#188 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TheCodeHeist-Coder/Rexial
Issue simili
-
area: image-engine bug priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
snapotter-hq/SnapOtter#3885 ·
I maintainer di solito rispondono entro 1 giorno
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 3 giorni
-
pending triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug P3 UI/UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
openclaw/openclaw#182077 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno