Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of proper typechecking #28

Open
canny bot opened this issue Mar 3, 2022 · 2 comments
Open

Lack of proper typechecking #28

canny bot opened this issue Mar 3, 2022 · 2 comments

Comments

@canny
Copy link

canny bot commented Mar 3, 2022

Current state of the backend code is not type-safe, this causes a lot of issues in the long run.
There's a few APIs relying on session data to fetch data in the database, but there is no type checking implemented to prevent a casting error from mongoose.
Affected files:

  • Code that uses db.user.findOne({ userid: req.session.userid }); or similar
    • No typechecking for req.session.userid before this line runs
  • Code that uses the checkperms function
    • Did implement type conversion, but parseInt can return NaN. However, the users model expects userid to be a number

https://tovy.canny.io/admin/board/bugs/p/lack-of-proper-typechecking

@canny
Copy link
Author

canny bot commented Mar 3, 2022

This issue has been linked to a Canny post: Lack of proper typechecking 🎉

@7kayoh
Copy link
Contributor

7kayoh commented Mar 3, 2022

AR: This issue should be marked as major and should be done before 1.x.x release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant