COS301-SE-2024 / occupi

A system to record and predict office occupancy on a day to day basis
https://occupi.tech
MIT License
8 stars 1 forks source link

[TASK] Implement request validator in backend to requests #81

Closed Rethakgetse-Manaka closed 1 day ago

Rethakgetse-Manaka commented 1 week ago

Task Request Implement the json validator for requests in the backend

@Rethakgetse-Manaka , please tick off as you complete each task by clicking on the task you are done with in this comment

Additional info Any additional info, articles that you think may help the developer should be added here.

waveyboym commented 1 week ago

@Rethakgetse-Manaka there are already some sanitization functions on the backend. I shall reference them below so that you don't have to rewrite them again:

  1. We have validateEmail -> https://github.com/COS301-SE-2024/occupi/blob/develop/occupi-backend/pkg/utils/utils.go#L98
  2. We have validatePassword -> https://github.com/COS301-SE-2024/occupi/blob/develop/occupi-backend/pkg/utils/utils.go#L105
  3. We have validateOTP -> https://github.com/COS301-SE-2024/occupi/blob/develop/occupi-backend/pkg/utils/utils.go#L138
  4. There is an input sanitizer here which prevents XSS attacks by removing malicious js scripts for example -> https://github.com/COS301-SE-2024/occupi/blob/develop/occupi-backend/pkg/utils/utils.go#L92

I am not sure if this will help you in what you are trying to achieve but I just thought I would make you aware at the very least