Is Datalog a good language for authorization?

This page summarizes the projects mentioned and recommended in the original post on

Our great sponsors
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Zigi - The context switching struggle is real
  • Scout APM - Truly a developer’s best friend
  • scryer-prolog

    A modern Prolog implementation written mostly in Rust.

  • swipl-devel

    SWI-Prolog Main development repository

    - And last but not least... the ability to convert authorization logic into SQL [4]. Which is done by having the language return constraints over any unbound (free) variables.

    To me this is what makes logic programming exciting for authorization. It gives you this small kernel of declarative programming, and gives you a ton of freedom to build on top.


  • InfluxDB

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Data Platform where developers build real-time applications for analytics, IoT and cloud-native services in less time with less code.

  • oso

    Oso is a batteries-included framework for building authorization in your application.

    Well this was fun to see! I'm the CTO of Oso, where we're building Polar (the second of the links mentioned

    I have a few really minor nitpicks, so will try and make up for it by adding to the discussion :)

    First of all, it doesn't really make sense to talk about Datalog as a good language for authorization, because much like with Prolog there doesn't really exist a single implementation of it. OPA's language Rego is a datalog variant, and Polar started out as a Prolog variant (although it's not really recognisable as one any more).

    And that's an important point because otherwise it would be pretty reasonable to decide that: logic programming is good for authorization => you should go find the most battle-tested language out there and use that. For example, there's SWI Prolog [1] and Scryer Prolog [2] as two of my favourites.

    To me, the thing that is mind-blowing about logic programming, is (a) how powerful the paradigm is, and (b) how concisely you can implement a logic programming language. Take miniKanren [3] which is a full-blown logic language in a few hundred lines of code.

    In my mind, the original article makes a decent case that logic programming is a good fit for authorization. And just generally I love anyone bringing attention to that :)

    But to me, the reason logic programming is such a solid foundation for authorization logic is the pieces you can build on top of it. For Polar, we've added:

    - Types! So you can write authorization logic over your data types and help structure your logic. We've implemented this by simply adding an additional operator into the language that can check types

  • biscuit-rust

    Rust implementation of the Biscuit authorization token

    (biscuit author here) I like how that post points a crucial issue in authorization systems: how powerful and flexible should we make them?

    If you go towards flexibility, you get more complexity and possibly unexpected results. And they become hard to audit and explain.

    You can choose simple, single purpose systems, like a RBAC only authz backed by a SQL database. You write tight, easy to understand policies. But systems always grow beyond the bounds of those rules, and you end up with a lot of ad hoc rules, or role explosion.

    Datalog was a good tradeoff for Biscuit ( powerful enough to cover a lot of use cases, simple enough to be implemented the same way in multiple languages

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts