fix: validate types for login email and password (500 on non-string or missing body)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- express, postgresql, typescript
- Lĩnh vực
- api, authentication, backend
Hướng nghiên cứu
Đọc apps/http-server/src/controllers/authController.ts và phần triển khai parseRegisterInput hiện có trong registerInput.ts để nắm mẫu phân tích đầu vào của dự án. Thêm các bài kiểm thử đầu vào đăng nhập cho các trường hợp object, array, number và thiếu body như mô tả. Công việc hoàn tất khi đầu vào không hợp lệ trả về phản hồi 400 rõ ràng thay vì gây ra lỗi 500.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 21
- Fork
- 7
- Merge trung bình
- 8 giờ 12 phút
- Pull request đã merge (30 ngày)
- 36
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TheCodeHeist-Coder/Rexial
-
bug good first issue help wanted UI & UX
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
TheCodeHeist-Coder/Rexial#178 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug enhancement good first issue help wanted UI & UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TheCodeHeist-Coder/Rexial#162 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Critical security: a couple of access control problems in the API and ws-server (details to be shared privately)Có thể đã có người làm @Anshuu2004 đã nhận 11 ngày trước. Đang mởlevel3 nsoc26
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
TheCodeHeist-Coder/Rexial#215 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement help wanted UI & UX
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
TheCodeHeist-Coder/Rexial#201 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A host cannot see who won a quiz they already hostedCó thể đã có người làm @Harshit214713 đã nhận 11 ngày trước. Đang mởenhancement good first issue help wanted level2 nsoc26 UI & UX
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
TheCodeHeist-Coder/Rexial#200 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TheCodeHeist-Coder/Rexial
Issue tương tự
-
FR: Support CJK brackets, symbols and full-width markers in footnoteHeuristics (EBPAJ support)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
readest/readest#7413 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
content triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
eliasstravik/herdr-projects#788 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Ability to edit tagsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày