This file defines the top-level correctness properties for the symbolic compiler. We show the encoding is sound and complete with respect to the concrete semantics of Cedar. That is, the symbolic semantics both overapproximates (soundness) and underapproximates (completeness) the concrete semantics. #
Let x be a Cedar expression, env a concrete evaluation environment (request
and entities), εnv a symbolic environment, and t the outcome of
compiling x to a Term with respect to εnv.
Let x and env be a well-formed input to the concrete evaluator, i.e.,
env.WellFormedFor x. This means that the entity store env.entities has
no dangling entity references, and all entity references that occur in x and
env.request are included in env.entities.
Let x and εnv be a well-formed input to the symbolic compiler, i.e.,
εnv.WellFormedFor x. This means that the symbolic entity store εnv.entities
has no dangling (undefined) entity types or references; all term types contained
in εnv.entities represent valid Cedar types; and all entity references that
occur in x and εnv.request are valid according to
εnv.entities.isValidEntityUID.
Let εnv represent a set of concrete environments that includes env, i.e.,
env ∈ᵢ εnv. We relate concrete structures to their symbolic counterparts via
interpretations, which map from term variables and uninterpreted functions to
literals. For example, env ∈ᵢ εnv if there exists a well-formed interpretation
I such that env ∼ εnv.interpret I are equivalent according to the sameness
relation ∼. Note that we can't use equality here, because interpreting a
symbolic structure with respect to an Interpretation produces a literal
symbolic structure (without any unknowns), which is then compared to the
corresponding concrete structure using a suitable sameness relation.
Given the above, the soundness theorem says that the output of the concrete
evaluator on x and env is contained in the set of concrete outcomes
represented by the output of the symbolic compiler on x and εnv. We state
soundness in terms of Outcomes rather than Results because the symbolic
compiler does not distinguish between different kinds of errors---only between
normal and erroring executions.
Let x be a Cedar expression and εnv a symbolic environment, where
x and εnv are a well-formed input to the symbolic compiler, i.e.,
εnv.WellFormedFor x.
Let t the outcome of compiling x to a Term with respect to εnv, and o a
concrete outcome represented by t.
Then, the completeness theorem says that there exists a concrete environment
env represented by εnv such that x and env are well-formed inputs to the
concrete evaluator and evaluating x against env produces the outcome o.
Let ps be Cedar policies, env a concrete evaluation environment (request and
entities), εnv a symbolic environment, and t the term resulting
from symbolically authorizing ps with respect to εnv, i.e.,
SymCC.isAuthorized ps εnv = .ok t.
Let ps and env be a well-formed input to the concrete authorizer, i.e.,
env.WellFormedForPolicies ps. This means that the entity store env.entities
has no dangling entity references, and all entity references that occur in ps
and env.request are included in env.entities.
Let ps and εnv be a well-formed input to the symbolic authorizer, i.e.,
εnv.WellFormedForPolices ps. This means that the symbolic entity store
εnv.entities has no dangling (undefined) entity types or references; all term
types contained in εnv.entities represent valid Cedar types; and all entity
references that occur in ps and εnv.request are valid according to
εnv.entities.isValidEntityUID.
Let εnv represent a set of concrete environments that includes env, i.e.,
env ∈ᵢ εnv. We relate concrete structures to their symbolic counterparts via
interpretations, which map from term variables and uninterpreted functions to
literals. For example, env ∈ᵢ εnv if there exists a well-formed interpretation
I such that env ∼ εnv.interpret I are equivalent according to the sameness
relation ∼. Note that we can't use equality here, because interpreting a
symbolic structure with respect to an Interpretation produces a literal
symbolic structure (without any unknowns), which is then compared to the
corresponding concrete structure using a suitable sameness relation.
Given the above, the soundness theorem says that the decision of the concrete
authorizer on ps and env is contained in the set of concrete decisions
represented by the output of the symbolic authorizer on ps and εnv. We state
soundness in terms of Decisions rather than Responses because the symbolic
authorizer computes only decision (and not the extra diagnostics contained in a
concrete Response).
Let ps be Cedar policies and εnv a symbolic environment, where
ps and εnv are a well-formed input to the symbolic authorizer, i.e.,
εnv.WellFormedForPolicies ps.
Let t the outcome of symbolically authorizing ps with respect to εnv, and d a
concrete authorization decision represented by t.
Then, the completeness theorem says that there exists a concrete environment
env represented by εnv such that ps and env are well-formed inputs to the
concrete authorizer and authorizing os against env produces the decision d.
For any well-typed expression tx in a well-formed environment Γ
(which can be produced by Cedar's type checker), the symbolic compiler
should never fail and produce a term t that is well-formed and has
the type TermType.ofType tx.typeOf.
Equations
- Cedar.Thm.IsOption tty = ∃ (tty' : Cedar.SymCC.TermType), tty = tty'.option
Instances For
Equations
Instances For
Weaker result than compile_well_typed, but requiring weaker hypotheses:
If compile on any expression (not necessarily well-typed) produces .ok t,
then t must have option type