EnCiv / civil-pursuit

Other
7 stars 8 forks source link

point model property validation in api's #149

Open ddfridley opened 2 months ago

ddfridley commented 2 months ago

We are deliberately loose on validity checks in the point model, but in the api calls is where we have the most vulnerability to hacks - (people deliberately inserting bad stuff).

We need to create methods for strong validity checks for the properties in model/point.js and export them so that the api's can use them.

See Joi an it's methods for validity checking in undebate-ssp/app/socket-apis/find-and-set-election-doc

In app/models/point.js Create and export validity checks for:

The name of the validity test should match the name of the property. Even better to consider if there is some shorthand way using joi or just an object to make the code clean and minimal in the apis.

ddfridley commented 1 month ago

@edmundj0 how is this going? Thanks.

edmundj0 commented 1 month ago

just created a draft pr, should be done soon, but let me know if I'm not going in the right direction!