English

Policy as Code, Policy as Type

Cryptography and Security 2025-06-03 v1 Programming Languages

Abstract

Policies are designed to distinguish between correct and incorrect actions; they are types. But badly typed actions may cause not compile errors, but financial and reputational harm We demonstrate how even the most complex ABAC policies can be expressed as types in dependently typed languages such as Agda and Lean, providing a single framework to express, analyze, and implement policies. We then go head-to-head with Rego, the popular and powerful open-source ABAC policy language. We show the superior safety that comes with a powerful type system and built-in proof assistant. In passing, we discuss various access control models, sketch how to integrate in a future when attributes are distributed and signed (as discussed at the W3C), and show how policies can be communicated using just the syntax of the language. Our examples are in Agda.

Keywords

Cite

@article{arxiv.2506.01446,
  title  = {Policy as Code, Policy as Type},
  author = {Matthew D. Fuchs},
  journal= {arXiv preprint arXiv:2506.01446},
  year   = {2025}
}

Comments

37 pages, github repo at https://github.com/mattdfuchs/policy-as-type

R2 v1 2026-07-01T02:53:59.135Z