biscuit-haskell-0.1.1.0: Library support for the Biscuit security token
Copyright© Clément Delafargue 2021
LicenseMIT
Maintainerclement@delafargue.name
Safe HaskellNone
LanguageHaskell2010

Auth.Biscuit.Datalog.Executor

Description

The Datalog engine, tasked with deriving new facts from existing facts and rules, as well as matching available facts against checks and policies

Synopsis

Documentation

data BlockWithRevocationIds Source #

A parsed block, along with the associated revocation ids.

Constructors

BlockWithRevocationIds 

Fields

data ExecutionError Source #

The result of running verification

Constructors

Timeout

Verification took too much time

TooManyFacts

Too many facts were generated during evaluation

TooManyIterations

Evaluation did not converge in the alloted number of iterations

FactsInBlocks

Some blocks contained either rules or facts while it was forbidden

ResultError ResultError

The checks and policies were not fulfilled after evaluation

data Limits Source #

Settings for the executor restrictions See defaultLimits for default values.

Constructors

Limits 

Fields

data ResultError Source #

The result of matching the checks and policies against all the available facts.

Constructors

NoPoliciesMatched [Check]

No policy matched. additionally some checks may have failed

FailedChecks (NonEmpty Check)

An allow rule matched, but at least one check failed

DenyRuleMatched [Check] Query

A deny rule matched. additionally some checks may have failed

Instances

Instances details
Eq ResultError Source # 
Instance details

Defined in Auth.Biscuit.Datalog.Executor

Show ResultError Source # 
Instance details

Defined in Auth.Biscuit.Datalog.Executor

data World Source #

A collection of facts and rules used to derive new facts. Rules coming from blocks are stored separately since they are subject to specific restrictions regarding the facts they can generate.

Constructors

World 

Instances

Instances details
Show World Source # 
Instance details

Defined in Auth.Biscuit.Datalog.Executor

Methods

showsPrec :: Int -> World -> ShowS #

show :: World -> String #

showList :: [World] -> ShowS #

Semigroup World Source # 
Instance details

Defined in Auth.Biscuit.Datalog.Executor

Methods

(<>) :: World -> World -> World #

sconcat :: NonEmpty World -> World #

stimes :: Integral b => b -> World -> World #

Monoid World Source # 
Instance details

Defined in Auth.Biscuit.Datalog.Executor

Methods

mempty :: World #

mappend :: World -> World -> World #

mconcat :: [World] -> World #

type Bindings = Map Name Value Source #

A list of bound variables, with the associated value

type Name = Text Source #

A variable name

computeAllFacts Source #

Arguments

:: Limits

The maximum amount of iterations that can be reached

-> World

The initial rules and facts

-> Either ExecutionError (Set Fact) 

Compute all possible facts, recursively calling itself until it can't generate new facts or a limit is reached

defaultLimits :: Limits Source #

Default settings for the executor restrictions. (1000 facts, 100 iterations, 1000μs max, regexes are allowed, facts and rules are allowed in blocks)

evaluateExpression :: Limits -> Bindings -> Expression -> Either String Value Source #

Given bindings for variables, reduce an expression to a single datalog value

runVerifier Source #

Arguments

:: BlockWithRevocationIds

The authority block

-> [BlockWithRevocationIds]

The extra blocks

-> Verifier

A verifier

-> IO (Either ExecutionError Query) 

Given a series of blocks and a verifier, ensure that all the checks and policies match

runVerifierWithLimits Source #

Arguments

:: Limits

custom limits

-> BlockWithRevocationIds

The authority block

-> [BlockWithRevocationIds]

The extra blocks

-> Verifier

A verifier

-> IO (Either ExecutionError Query) 

Given a series of blocks and a verifier, ensure that all the checks and policies match, with provided execution constraints