Skip to content

fix: validate types for login email and password (500 on non-string or missing body) #235

Open

Description

@Anshuu2004

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:

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.

Activity

  1. Timing007 commented on Nov 18, 2026

    @Timing007

    Hi @Anshuu2004,

    I would like to work on Issue #235 under NSOC 2026. I'll implement login input validation, handle missing or invalid request bodies, and add tests to ensure incorrect input types return proper 400 errors instead of 500.

    Please assign this issue to me. Thank you!

  2. spikedeeev commented on Nov 18, 2026

    @spikedeeev
    Contributor

    Hey! I'd like to work on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions