Skip to content

JPYC.allowlist_auth

名称・種別

  • 名称: JPYC.allowlist_auth
  • 種別: theorem
  • モジュール: JpycFormalVerification.AccessControlTheorems
  • ソース: JpycFormalVerification/AccessControlTheorems.lean:604-606
  • 概要: (un)allowlist の成功は allowlister が呼んだことを含意する(権限)。
  • 仕様: 対象

型シグネチャ

lean
∀ {s s' : JPYC.State} {ctx : JPYC.CallContext} {account : JPYC.Address}, Eq (JPYC.allowlist s ctx account) (Except.ok s') → Eq ctx.sender s.allowlister

allowlist の成功は、呼び出し元がallowlisterであったこと(ctx.sender = s.allowlister)を含意する、という認可定理です。

和訳 docstring

認可。 許可リスト登録・解除は allowlister のみが成功できる。

解説

何を述べているか。 allowlist が成功したなら、ctx.sender = s.allowlister、すなわち呼び出し元がallowlister本人だったことが導けます。*_ok 特徴づけの第 1 成分を取り出すだけです。

直感。 「この操作が通った ⇒ 権限者が呼んだ」。特権操作を権限者に閉じ込める、アクセス制御の中心的な保証です。

なぜ安全性に効くか。 権限のないアカウントは、たとえ他の条件を満たしても、この操作で状態を変えることができません。ロール検査ガードを最初に置く設計が、この性質として結実しています。

図解

Lean ソースコード

lean
/-- **Authorization.** (Un)allowlisting succeeds only for the allowlister. -/
theorem allowlist_auth {s s' : State} {ctx : CallContext} {account : Address}
    (h : allowlist s ctx account = .ok s') : ctx.sender = s.allowlister := (allowlist_ok h).2.1

依存