You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The terminate_contract function call must be protected with access controls that check the address of the caller. This is necessary to avoid destructing the contract by malicious third-parties.
Examples:
#[ink(message)]pubfnbad(&mutself) -> Result<()>{self.env().terminate_contract(self.sender);// Error: no access control}#[ink(message)]pubfngood(&mutself) -> Result<()>{ifself.env().caller() == ALLOWED_USER{// OK: Checks the callerself.env().terminate_contract(self.sender);}}
The implementation should check the control flow in MIR, finding if there is a statement with conditional expression that uses self.env().caller() prior to the terminate_contract MIR terminator.
The
terminate_contract
function call must be protected with access controls that check the address of the caller. This is necessary to avoid destructing the contract by malicious third-parties.Examples:
The implementation should check the control flow in MIR, finding if there is a statement with conditional expression that uses
self.env().caller()
prior to theterminate_contract
MIR terminator.Reference: SWC-106
The text was updated successfully, but these errors were encountered: