Challenge #8tx.origin Misuse

Difficulty: High
#Security#AccessControl
This contract uses tx.origin for access control, which is insecure.
Illustration for tx.origin Misuse

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0;
contract HiddenName {
string public storedName;
function set Name (string memory name) public { bytes memory temp = bytes(name);
if (temp.length > 0) {
storedName;
}
function getName() public view returns (string
memory) {
return storedName;
}
}
    
💡 Hint: tx.origin can be manipulated. Prefer msg.sender.