Linting rules
E017: unauthorized-access
Detects storage mutations (`contract.setData(...)`, `*.save()`) that are reachable without a preceding admin sender check.
Metadata
Code:E017Rule:unauthorized-accessStatus: Preview sincev0.0.1Quick fix: sometimes available
What it does
Detects storage mutations (contract.setData(...), *.save()) that are reachable
without a preceding admin sender check.
Why is this bad?
State-changing operations that are not guarded by admin authorization may allow arbitrary inbound senders to mutate contract storage.
Example
fun onInternalMessage(in: InMessage) {
val storage = lazy Storage.fromCell(contract.getData());
storage.save();}Use instead:
fun onInternalMessage(in: InMessage) {
val storage = lazy Storage.fromCell(contract.getData());
assert (in.senderAddress == storage.adminAddress) throw ERR_UNAUTHORIZED;
storage.save();
}Last updated on