Function setPassword
comment says the function only allows the owner to set the password, but there is no owner check in the function, allowing anyone to set the password.
There is no test covering the expectation of a revert when a non-owner calls setPassword
.
Anyone with the contract address would be able to set the content of s_password
, which is contrary to the intent of the function. Further, it would overwrite the value stored in s_password
, which would prevent the owner from retrieving what they stored.
The contract doesn't live up to what it says.
Wrote a Foundry test after reading the comment on the function. Test fails:
Add owner check to setPassword
, like there is in getPassword
. Write a test covering the non owner setting password case, like there is for testing non owner reading the password.
Anyone can call `setPassword` and set a new password contrary to the intended purpose.
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.