You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
update_movie_review do not include any check on the rating input, allowing the rating to be out of the 1-5 limit.
This test highlights the situation:
it("Movie review is updated with incorrect rating`",async()=>{constnewDescription="Wow this is new";constnewRating=10;// Rating should not be above 5consttx=awaitprogram.methods.updateMovieReview(movie.title,newDescription,newRating).rpc();constaccount=awaitprogram.account.movieAccountState.fetch(moviePda);expect(newRating===account.rating);expect(newDescription===account.description);});
Proposed Solution
Add the same require! in update_movie_review as in add_movie_review:
Problem
update_movie_review do not include any check on the
rating
input, allowing therating
to be out of the 1-5 limit.This test highlights the situation:
Proposed Solution
Add the same
require!
inupdate_movie_review
as inadd_movie_review
:The text was updated successfully, but these errors were encountered: