gcivil-nyu-org / team-5-inperson

3 stars 4 forks source link

Testing Party Issue - Can bypass HTML Limitations and give rating outside 1-5 #163

Open sjeremycohen opened 1 year ago

sjeremycohen commented 1 year ago

Environment Information: OS Windows 11 Browser - Brave 1.45.127 Chromium 107.0.5304.110 (Extensions Disabled - Private Browser Window) Credential Used - user5@test.com

Reproduction Steps

  1. Log in
  2. Open any "Add a Review" Dialogue
  3. Right Click > Inspect on the Modal
  4. Find <input type="number" name="rating" required="" min="1" max="5" value="">
  5. Edit this to <input type="number" name="rating" required="" value="">
  6. Submit a rating outside the 1-5 range
  7. You'll get an error, but it saves!
  8. Open the reviews panel

Results Instead of the validation on the modal box, there is a pop up on the page telling you an incorrect value was entered, but it still accepts this value into the database!

image

Additional Notes Frontend validation is not enough here, you need to be validating this in the database as well! You can find easy detailed implementation instructions for the model here https://docs.djangoproject.com/en/4.1/ref/models/fields/

ds6332 commented 1 year ago

Thank you!