Non-owner of the contract is allowed to set a new password.
setPassword does not check if msg.sender = s_owner.
Anyone can set a new password which defeats the purpose of this contract.
Forge test on this function:
function test_non_owner_can_set_password() public {
vm.startPrank(address(1));
string memory fakePassword = "New Password But Not Owner's";
passwordStore.setPassword(fakePassword);
vm.startPrank(owner);
string memory actualPassword = passwordStore.getPassword();
assertEq(actualPassword, fakePassword);
}
Add a require or if statement like the one in getPassword.
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.