Declared-fact coverage for a policy: every column its rules read is a
declared fact. check/1 builds the rule of every protected schema for
every operation the role table names, and applies it to the schema. Then
it walks the query the rule became, subqueries among them, and collects
every field reference by source schema. A column counts as declared in
one of these cases:
- the schema's
factnames it as the column, the subject, or the object - the schema's
relationshipnames it as the subject, the object, or an attribute - it is the primary key
- it is the foreign key of a relation some protected schema carries, through the closure of what the carried schemas carry in turn
The walk cannot enter a fragment, so a fragment fails as the finding
{:fragment, text}.
Summary
Types
Functions
@spec check(Mediate.Rbac.Policy.t()) :: :ok | {:error, [finding()]}
Ok, or the undeclared reads, sorted and without repeats.
@spec check!(Mediate.Rbac.Policy.t()) :: :ok
check/1, but raises with every finding in the message.
@spec reads(Mediate.Rbac.Policy.t()) :: [finding()]
Every read the policy's rules make, as findings, before the removal of the declared ones.
@spec undeclared(Mediate.Rbac.Policy.t()) :: [finding()]
Every undeclared read across the policy's rules.