fix: validate types for login email and password (500 on non-string or missing body)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 82/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- express, postgresql, typescript
- Bereich
- api, authentication, backend
Rechercherichtung
Lies apps/http-server/src/controllers/authController.ts und die vorhandene Implementierung von parseRegisterInput in registerInput.ts, um das Eingabeparsing-Muster des Projekts zu verstehen. Füge Tests für Login-Eingaben für die Fälle Objekt, Array, Zahl und fehlender Body wie beschrieben hinzu. Fertig ist die Arbeit, wenn ungültige Eingaben eine klare 400-Antwort zurückgeben, statt einen 500-Fehler zu verursachen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
userLoginController (apps/http-server/src/controllers/authController.ts) is the one auth input that is still only checked for being truthy. Register has parseRegisterInput, and join and create quiz got the same treatment in #231, but login still does const { email, password } = req.body and if (!email || !password).
What happens
From reading the code, POST /api/v1/auth/login should give a generic 500 in these cases:
- No JSON body: the destructure throws, same as the no body case that #234 fixed for join.
{"email":{},"password":"x"}: gets past the check, then Prisma throws a validation error infindUnique.{"email":"[email protected]","password":123}:bcrypt.comparethrows on a non string.
I didn't run these against a database, the join versions behaved this way when I tested #234.
Expected behaviour
400 with a clear message for wrong types.
Proposed fix
A small parseLoginInput next to registerInput.ts, returned through the existing errorResponse(res, 400, ...), with tests for the object, array, number and no body cases.
Happy to send a PR for this, and #234 is merged so I don't have anything else open here. Labels and level are your call.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 21
- Forks
- 7
- Ø Merge
- 8 Std. 12 Min.
- Gemergte PRs (30 T.)
- 36
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus TheCodeHeist-Coder/Rexial
-
bug good first issue help wanted UI & UX
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
TheCodeHeist-Coder/Rexial#178 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug enhancement good first issue help wanted UI & UX
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
TheCodeHeist-Coder/Rexial#162 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Critical security: a couple of access control problems in the API and ws-server (details to be shared privately)Evtl. vergeben @Anshuu2004 hat das vor 11 Tagen übernommen. Offenlevel3 nsoc26
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
TheCodeHeist-Coder/Rexial#215 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement help wanted UI & UX
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 54/100
TheCodeHeist-Coder/Rexial#201 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
A host cannot see who won a quiz they already hostedEvtl. vergeben @Harshit214713 hat das vor 11 Tagen übernommen. Offenenhancement good first issue help wanted level2 nsoc26 UI & UX
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 58/100
TheCodeHeist-Coder/Rexial#200 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in TheCodeHeist-Coder/Rexial
Ähnliche Issues
-
FR: Support CJK brackets, symbols and full-width markers in footnoteHeuristics (EBPAJ support)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
readest/readest#7413 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
content triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
eliasstravik/herdr-projects#788 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Ability to edit tagsOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag