Gelato Network
Search
K
Comment on page
🔐

Security Considerations

Dedicated msg.sender

For security reasons, during task creation, you will see an address which will be the msg.sender for your task executions.
If you are the owner of the target contract in question, it's recommended to implement a msg.sender restriction within your smart contract. This involves whitelisting a dedicated msg.sender address. Such a measure ensures that only tasks you have created can call your function, significantly elevating the security posture of your operations. For a hands-on guide and to manage your dedicated msg.sender settings, please connect to the app and visit your own Settings page.
Remember that your dedicated msg.sender can vary across different blockchain networks. You can view the dedicated msg.sender for each network through the provided settings link.
msg.sender restrictions should be added to the function that Gelato will call during execution, not the checker function. Learn more about it here: 1. Understand the Role of a Checker
You can have this restriction by inheriting AutomateReady
AutomateReady exposes a modifier onlyDedicatedMsgSender which restricts msg.sender to only task executions created by taskCreator defined in the constructor.
modifier onlyDedicatedMsgSender() {
require(msg.sender == dedicatedMsgSender, "Only dedicated msg.sender");
_;
}
If you would like to have additional callers for your function. You can implement a whitelist like so.
mapping(address => bool) public whitelisted;
modifier onlyWhitelisted() {
require(
whitelisted[msg.sender] || msg.sender == dedicatedMsgSender,
"Only whitelisted"
);
_;
}