fix: validate types for login email and password (500 on non-string or missing body)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- express, postgresql, typescript
- 領域
- api, authentication, backend
調査の方向性
プロジェクトの入力解析パターンを確認するため、apps/http-server/src/controllers/authController.ts と registerInput.ts にある既存の parseRegisterInput の実装を読みます。説明にあるとおり、オブジェクト、配列、数値、body がない場合のログイン入力テストを追加します。無効な入力で500を発生させず、明確な400レスポンスを返すようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 21
- フォーク
- 7
- 平均マージ
- 8時間 12分
- マージ済み PR(30日)
- 36
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TheCodeHeist-Coder/Rexial のほかの issue
-
bug good first issue help wanted UI & UX
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
TheCodeHeist-Coder/Rexial#178 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug enhancement good first issue help wanted UI & UX
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TheCodeHeist-Coder/Rexial#162 ·
メンテナーはふだん 1 日以内に返信
-
Critical security: a couple of access control problems in the API and ws-server (details to be shared privately)対応中かも @Anshuu2004 が 11 日前に担当しました。 オープンlevel3 nsoc26
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
TheCodeHeist-Coder/Rexial#215 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
enhancement help wanted UI & UX
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
TheCodeHeist-Coder/Rexial#201 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
A host cannot see who won a quiz they already hosted対応中かも @Harshit214713 が 11 日前に担当しました。 オープンenhancement good first issue help wanted level2 nsoc26 UI & UX
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
TheCodeHeist-Coder/Rexial#200 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
TheCodeHeist-Coder/Rexial の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
readest/readest#7413 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
content triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eliasstravik/herdr-projects#788 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Ability to edit tagsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信