The problem with the code is that it does not adequately protect the stored password, and it relies solely on the msg.sender to check the owner's identity.
function setPassword() don't check that the caller is owner or not
problem is that anyone who has the contract's address can become the owner and set or retrieve the password.
VScode
Use modifier to check that caller is owner
modifier onlyOwner() {
require(msg.sender == s_owner, "Only the owner can call");
_;
}
function setPassword(string memory newPassword) external;
function setPassword(string memory newPassword) external onlyOwner;
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.