In ScoreBoard.sol
, setPrediction()
should only allow approved players to set a prediction according to the contest description. But this function let any user set a prediction.
Any user can set a prediction even if he is not approved as a Player by the Organizer because of a lack of check.
https://github.com/Cyfrin/2024-07-the-predicter/blob/main/src/ScoreBoard.sol#L61-L75
There is no Modifier or other proceeding checking if the user is an approved Player.
A non authorized user can play the game. This is basically cheating.
Code review with VisualCode.
Mitigation :
Adding a Modifier
onlyPlayer()
that is going to check if the user is indeed authorized by the Organizer to play the game.
This can be done by checking if user is present in players[]
.
This method will function but it is gas consuming because of the way we keep track of the authorized players.
Instead of using a address[] public players
the developer should use a Mapping
, this way we won't have to browse the entire players table when checking if a user is authorized to play or not.
setPrediction has no access control and allows manipulation to Players' predictions.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.