Skip to content

ServerError: Inconsistent handling of invalid input #15648

@nikita-fuchs

Description

@nikita-fuchs

Please try understanding the severity of this issue for running Strapi in production.

Bug report

Required System information

Node.js version: 16.14.2
NPM version: 8.5.0
Strapi version: 4.6.0
Database: Postgres
Operating system: Ubuntu 20.04

Describe the bug

Currently, wherever API data is checked 'manually' and not through the validation mechanism, the default behaviour is throwing a server error. A small excerpt:

image

This leads to two problems:

  1. How is a frontend supposed to know what the issue with some user's input is, if the only reply is a 500 server error? Is it a bug in the code my client's users should report to us, or was there just some issue with a wrong password?

  2. If you throw an error right away every time some user enters a wrong password, your event monitoring tool will look like this and it's impossible to filter out real issues:

image

Expected behaviour

No errors thrown when there isn't actually something failing. The correct thing to do here is a proper HTTP response, ideally formatted the same way as the regular validation errors.

Come on guys, I see the amount of hard work you've put in this awesome project, don't let bad execution of basic practices overshadow all the hard effort. 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions