-
Notifications
You must be signed in to change notification settings - Fork 59
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
Adding validations for body of request. #148
Comments
Hey @Aryaman1706! Thanks for opening this issue! We had thought about validation but didn't think much on the security aspect. Can you check out my comments at #159 too and let us know what you think here? Also, do you find any vulnerabilities in our API already? Thanks again! |
Hey @anandbaburajan ! I read that discussion and I somewhat agree that mongoose validators could do the job, but don't you think that in case of an invalid request body, we should not allow the data to reach the saving stage as mongoose validators are pre-save hooks? I think we should keep validation of request as a separate step, this way we could save on some unnecessary operations being performed and would be able to deliver intuitive error messages to users. Also if you use something like yup, we could also reuse the validation schema on react side as well with formik for validating it there and then. I have not tested the API thoroughly, I am gonna do it tonight and would get back if I found some issues.
Thanks a lot for addressing the raised issue so soon and I would love to discuss the issue further. |
I agree, validattion would be good. But since the only user of this API would be the RM-client, do you suggest handling the necessary validation only at the client provided the server handles all the edge cases like the ones you mentioned?
Good catch, thanks! You're welcome to fix it.
Thanks for your thoughts! :D please let me know what you think! |
Sure, I am on it. Would soon raise a PR to fix the same. Thanks a lot. |
Good point, makes sense, thanks! You're welcome to go ahead with validation. :D |
Update: our API endpoints are now inside |
Feature Request
Advantages
Implementation
Additional Context
The text was updated successfully, but these errors were encountered: