hiyaryan / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling distorted thinking and finding alternative modes of thought (i.e. reframing) while cognitive distortions are occurring. The CDJ does that work for you. -- The CDJ is in beta testing!!
https://thecdj.app
3 stars 0 forks source link

Add schema validations. #12

Closed hiyaryan closed 9 months ago

hiyaryan commented 9 months ago

This PR incorporates Joi schema validations. It is the first of several (loggedIn, authorized, to name a few) middleware added to API requests.

hiyaryan commented 9 months ago

Important!

The last commit fixes a critical potential mal-use of the API where an attacker may post an entry to a non-existent journal. This is one instance where middleware should be used to prevent this from occurring. Other holes in the API should be patched and will likely be discovered in future PRs where being logged in and authorized is required.