eosio.cdt icon indicating copy to clipboard operation
eosio.cdt copied to clipboard

check* intrinsics naming conventions

Open MrToph opened this issue 5 years ago • 0 comments

I was under the impression that the check* functions throw an assertion error like eosio::check does and a bit surprised that check_permission_authorization and check_transaction_authorization do not.

Instead, both functions return a boolean and to write secure code that aborts if not authorized, one has to write code that reads strangely:

check(
  check_permission_authorization(get_self(), name("dummy"), provided_keys),
  "wrong key"
);

Imo, renaming check_permission_authorization to has_permission_authorization(and check_transaction_authorization to has_transaction_authorization) would be helpful to avoid confusion and prevent bugs / security issues.

MrToph avatar Feb 13 '20 04:02 MrToph